Published Web files, can they be converted back to solution? - c#

Is it possible to take a set of published web files and convert them back into a solution? I say this because a solution has been lost from our system, and the only files that can be found are the actual published files. I have looked around and can't seem to find anything on the matter, any help would be great!
Thanks a lot

For a Web Application the source code is compiled into DLL's. As far as I know there is no easy way to reverse engineer a Web Application back to source code. If you wish to do further research, use search terms such 'reverse engineer web application DLL', or 'retrieve source code from DLL' etc. Good luck!

Related

Properly publishing/deploying a blazor project to github pages

I'll start this by saying I'm definitely working a bit above my paygrade here. I'll be doing my best to describe this problem and make it easiest to answer.
I've made a Blazor project in Visual Studio and this is connected to the GitHub repository here in the gh-pages branch. After reading Blazor's hosting and deploying guide here, I published the project in Visual Studio and copied the files in the /bin/Release/netstandard2.0/publish/ChargeLearning/dist folder to the root of the repository resulting in a repository with this file structure:
ChargeLearning
ChargeLearning
_content
_framework
css
sample-data
ChargeLearning.sln
index.html
At this point I think am already neck-deep in bad practice.
Regardless, attempting to load the index.html results in 404 errors in the console for most of the files in the html header like bootstrap (as the blazor deploying guide warned).
So I followed the instructions there as best as I could, attempting to implement this single page app (SPA) fix for gh-pages linked in the guide.
I added the 404.html file to the ChargeLearning repository now when I load the page it displays just one 404 error, for the blazor.webassembly.js file.
I then add the redirect script from the SPA fix to my willthamic.github.io repository which when I open the direct url to the blazor.webassembly.js file seems to redirect properly but github shows my home page and I now realize that it has been severely mangled and now images aren't loading.
I feel like I am doing a lot of things wrong here which makes it difficult to isolate and solve a single problem at once.
If you have specific advice on how to properly deploy this or even small things on how to do what I'm trying to do a little more properly I would greatly appreciate it.
Thanks in advance.
The blazor.webassembly.js file was stored in a directory beginning with an underscore (_framework), which github's jekyll ignores when deploying the website. After adding a file named .nojekyll to the root of the repository there was still a 404 error which confused me for a very long time. It then turned out I needed to make a change to another file to cause the website to be rebuilt, finally correcting the issue.
I still feel as though I am doing many things which could be bad practice, but that is for another day. If someone has any advice relating to that I will award the bounty for it.
Looking at the current state of your gh-pages branch I'm guessing you've mixed the files that were in the publish directory with the source files from your solution? If so, you just need to clean the source files out of the gh-pages branch so only the files you copied from the publish directory are present.
Other than that what you have now looks to be correct.

Getting code from Windows Azure VM

OK, so my hard disk just crashed. Big deal. All my web dev code that was on it went along with it, and now I'm running ddrescue on Ubuntu trying to recover whatever data I can recover. The hard disk keeps disconnecting and sometimes it can quit responding for a long time so it's really a pain in the ass.
Anyway, back to the main topic--I have my web dev code which was packaged and uploaded to Azure; now what I'm wondering is if it's possible to obtain all my .cs files from the VM. I noticed approot and siteroot folders, but all I saw were the views, the .asax file, some other misc, stuff, nothing with the .cs extension.
Is there any way I can get a copy of the code I packaged? or (as a last resort) any way to get the .cspkg file and work from there?
The site you are seeing on the web role and inside the cspkg file is the output of the compile, so you can't get the original .cs files out of them. That said, you can use a tool like Reflector, Just Decompile, or a variety of other decompilers out there to reverse engineer your compiled bits into something that will be very close to the original C# code (not I'm assuming this is your own code, or code that doesn't have a provision against reverse engineering). This at least will let you use the bits on the webrole to get the majority of your code back, then review it to see how good a job it did.
Note, you can open the cspkg file. It's just a zip file. You can rename with a .zip file extension and open it up, but you won't find the .cs files in there. The only time you find this to be the case is if you have multiple websites within a single web role. The default packager for Windows Azure doesn't compile the additional sites, only packages up all the files in their root directory. Not at all helpful for actual deployments really, but this won't likely help you.
You are likely well ahead of me on this, but I'd recommend using a personal source control system of some sort to avoid this issue in the future.

ASP.net Create a Torrent from File

Our current software updates are hosted on our server.
We'd like to offer Torrents as an alternative download option from our server. When new releases are published it should offer people better download speeds if people seed it.
I've figured out everything except how to create a Torrent file automatically (we'd rather not have to create it manually each time).
Does anyone know how we can create a torrent file from a specified exe file?
Thanks!
MonoTorrent seems like it might be of help. I've previously compiled and run it under .net, so no worries there.
This looks like the relevant wiki page.
As usual, it's probably best to check license compatibility before integrating with your product, but it looks quite permissive.
Of course, you'll need to host the torrent to ensure at least a single seed!

How to write and testing ASP.NET 4 on notepad?

Conditions:
I've been asked to develop a simple ASP.NET 4(C#) project in notepad. I'm completely new to this area.
The completed project should include several .aspx files, one master page, one sitemap and a web.config.
The book I'm using is a beginner cook book, based on using Visual Studio 2010 Express.
Developing it on notepad is a requirement to this school assignment.
Questions:
As what I know now VS2010 has its built-in Development Web Server which notepad doesn't. Should I test .aspx files by opening notepad files in browser? Will tags with runat="server" work?
Is there any helpful site or post that you know?
How should I testing master page?
Forgive my noob questions. The most sites I can find is teaching people how to develop by using VS2010, which is like my book, instead of notepad. The schedule is tight so I need some help here. Thank you for your time. I'll also share my experience when I finish this assignment.
It's a little more complicated than "runat="server"".
To give a little bit of 101, you will need:
A web server. The most natural one to use is IIS. I believe you should be able to use Apache as well if you're feeling adventurous.
The application framework. Guess what, it's .NET! There's also Mono if you're not using IIS. The application framework should also include the compiler. C# is a compiled language, so before you can run the code, you will have to compile it first. This is slightly different when compared to PHP.
The editor. You should be able to use Notepad, but Visual Studio provides you with more than just a fancy text editor. It helps you create the build script (the command that you send to the compiler), it helps you with project organization, and it helps you debugging.
So just using Notepad is doable, but you'll lose so much time for not using a free tool like Visual Studio Express.
Now to actually answer your questions:
No, it doesn't work that way. You will need a web server (see point 1 above) and a compiler (see point 2 above).
That's a little bit too broad. Your book should be a good starting point.
See answer 1.
I have finished that assignment. Here is my experience:
First, to develop an ASP.NET project on notepad or textpad is very unwise, unless you want to test your coding skill or having some other reasons. Because for beginner the best way to test your code is using VS "Ctrl+F5". If you write your code in notepad/textpad and test them in VS, it kind of defeat the original purpose.
There is a few tips, for the beginner like me.
Named your sitemap file "web.sitemap", and put it in the root directory of your project, otherwise you may have to go through complicated configuration process.
P.S. This is not a compulsory requirement, you can change the file name or directory, but you need to add site map provider in "web.config".
2 Choose your solution or project root directory carefully, because it is not easy to redefine it.
P.S. I spent a lot of time to move files around in Windows Explorer because I wanted to change my current solution directory to another folder.
These are the tips I find most useful. I would've saved at least 2 hours if I know these in the beginning.

Visual Studio 2008 C# - Recover solution from application manifest possible?

Hello I recently deleted what I thought was an unused folder which happened to have the solution and code for a windows application I am maintaining.
I have published the app multiple times with ClickOnce and have access to the application manifest, deploy, etc. Is there a way for me to use the published application to get back my solution?
Thanks
If you don't currently use source control, I would highly recommend using one. I'm not aware of a way to get back all the solution files without source control, but you can get back the code using .NET Reflector. There is a file disassembler add-in which allows you to dump the code straight out of Reflector.
not possible. you can't recover the solution and original code from the compiled and deployed version.
if you have not used that machine or hard drive since you deleted it, you may be able to recover the files but it's a long shot and may be expensive.
you need to invest some time in learning source control. git, mercurial, subversion... they're all free and easy to use in windows. having your code in source control would prevent this problem - delete it all you want, just do a checkout from source control again.
Just go get the project back from Subversion.
Basically all you can do at this point is feed the assemblies to a program like reflector and reverse engineer it back. Welcome to sucksville.
If you don't have your stuff in some type of repository already I'd highly recommend fixing that first thing in the morning. With free tools like subversion available, nevermind things like TFS or even VSS there just isnt a good excuse.

Categories

Resources