Can it be done? Yes. Is it easy? No. This is why you should always ensure you are using source control.
The CSS file is a content file so that is on your web server along with any other content files like images, JS files, etc.
You mentioned ASPX so that means you're using web forms. The ASPX files are also deployed on the web server directly as well so you should be able to get them.
What you won't have is the aspx.cs
files that contain the codebehind written in C# and any custom .cs files you had. Assuming you are building a traditional web forms app then all that code got compiled into a DLL when you built your code. The only way to get that code back is to decompile the DLL.
Get a decompiler for .NET. JustDecompile
is old but works well. There is also ildasm
from MS but I never really liked that tool. CodemerxDecompile
is a newer tool and doesn't work quite right for me but it could also be used. Irrelevant have the decompiler decompile your web app's DLL to get to the code. Then comes the fun part.
There will be no project file so create a new web project using the same name as what you used before. This gives you the basic structure that the project needs to be in. You will be either adding to this project or replacing the existing files as you go along to match what you had before.
- For each aspx file create a corresponding
.aspx.cs
file. In the decompiled code find the class that was generated for the.aspx
page and put it into the class. Depending on your decompiler you may need to adjust the code to actually compile. - For any code unrelated to pages you'll need to create additional
.cs
files to store them. For example if you have aUser
class then create aUser.cs
file and copy the class into there. - Most likely you had a
Globals.asax.cs
file that contained the global app startup logic. You'll need to create/update that file and put the app startup code there. - If you had custom handlers (
.ashx
) or controls (.ascx
) then you'll need to do the same sort of thing there. - Copy all your content files into the new project as well. Most likely you were relying on NuGet packages so some of those files may already be there.
- The
web.config
file would have been copied to the web server as well so you can grab that file and put it into your project. Note that it may not quite line up with what your project is expecting because of NuGet packages and whatnot so you might need to adjust your project settings and packages to match what was actually deployed.
After that it is a matter of compiling and fixing things that don't line up.