import or load .net website in visual studios - asp.net

I am really new to web development in .Net with Visual Studios. So I wasn't sure what keywords to query in search engine to solve my problem.
Anyway, I inherited a .Net website project. Except for just 3 .aspx.cs files, pretty much every other file is a .aspx file.
I don't see any .csproj or any .sln files.
If I want to load up this website on my localhost, how would I go about doing it? Am I supposed to load up Visual Studios and "import" these *.aspx.cs and *.aspx file?
I already successfully set up the SQL Server database and updated the web.config with the appropriate credentials.
Thanks

Just use File->Open->Web Site.

Related

How to add project (.sln) into existing asp.net website files

I have tried almost all methods to make new project using exisiting files of asp.net in vs 2010 but i failed to run on new machine.
each time i did this it shows error that "could not load project from d:\path name" etc etc that is my last computer path name
Now what i am looking for , i have a website and all asp.net pages but i am unable to see its working by single click on project exe .
please help me out that how i can make project using existing asp.net files
remember : i have only asp.net pages to laod directly into visual studio but i want project exe so when i click on .sln file i can see site working.
In order for it to work you need to keep in mind you have to use original source code and not pre-compiled code from the server. To import your old files into a .sln file:
Create a New Website/Web Application
Add Existing Item Select item(s)
that you are trying to import into this new solution.
Make sure you dont add any .vbproj or .sln files from the previous project.

Decompile Asp.Net web site Project

we have an application in production and the code is in Pre-Compiled form. And I could'nt reach any source code. I searched a few web site, they suggest Reflector so used Reflector to get code behind files. I reached cs files and add them by changing the asp.cs. But I do not reached aspx.degigner.cs files. And when I build my project Dll files do not compile. Their modify date seen old date. I make a mistake I know but I could not solve this problem. Have any ideas on this issue?
You can easily recreate your designer files by right-clicking on your Web Application Project and choosing "Convert to web Application"
You can find the compiled binaries in the ASP.NET Temporary Files location.
%SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET
Files

Recover ASP.NET Project from IIS Deployment

I'm a real newbie for ASP.NET web development, having a background in Java. A friend has an ASP.NET 3.0 deployment running on IIS. He can't find the original project files created in Visual Studio 2008 and has asked me to give him a hand.
Is it possible to recreate the project from the deployment on IIS? I see lots of ASPX and and CS files so in the inetpub[domain]\httpdocs directory.
I don't see the .SLN file. I assume that's what he needs. Would it be a real chore to rebuild? Are there any assets or source files that won't be deployed to ISS that I'd need to recreate?
Thanks
Re-creating the soloution/project files is (potentially) a small part of the recovery. Do you see any .aspx.cs or .aspx.vb files on the web server? If not, you'll need to extract the code from the code for each .aspx file from the DDL's in the web site's /bin folder. You can reverse engineer any .Net code quite easyily luckily with reflector, however all comments will be lost.
If you have the aspx and the cs files, you are in business: all you need to do is create a new Web Project in Visual Studio and select "Add Existing Files". You would then select all your aspx pages only and the cs files should get automatically imported for you.
Obviously, as anything, you'd probably have some references missing and what not, but shouldn't be incredibly painful to fix all those issues.
If it's a compiled web application project the code will be in a compiled assembly in the bin folder. This can be decompiled with .NET reflector. The source will be readable but not as original.
If it's a website project you're in luck. The code files will be in the website structure (*.aspx.cs or *.aspx.vb). These will constitute pretty much all of the assets you need to recreate the site in Visual Studio. Creating a project and solution file to manage these in VS will be the easy bit.

Must I upload compiled .dll files to get a asp.net site to work?

Sorry if this sounds like a noob question.
I downloaded this asp.net project from the live server - the client said it has everything needed to run. I don't know what version it is, but it doesn't have .designer.cs files, only .cs files, so I guess it's pretty old.
When I open the project in vs2008, it gives a lot of errors, so I can't compile it locally.
The questions is:
As I need to make changes in .cs files, do I only need to upload the .cs files to get it to work? Don't I need to compile the project and upload the .dll files??
Thank you!!
It sounds like you may have a "web site" type project:
Difference between 'Web Site' and 'Project' in Visual Studio
Is there a csproj file? If not, then you can be pretty sure that it is. This project type compiles dynamically, so the cs file is present on the server. I don't care for this type personally, and would convert it to a web application, but that's just me.

ASMX Web Service online works when all of the code is in one file without code-behind

I have an ASMX Web Service that has its code entirely in a code-behind file, so that the entire contents of the .asmx file is:
<%# WebService Language="C#" CodeBehind="~/App_Code/AddressValidation.cs" Class="AddressValidation" %>
On my test machine (Windows XP with IIS 5), I set up a virtual directory just for this ASP.NET 2.0 solution and everything works great. All my code is separated nicely and it just works.
However, when we deployed this solution to our Windows Server 2003 development environment, we noticed that the code only compiled when all of the code was dropped directly into the .asmx file, meaning that the solution didn't work with code-behind. We can't figure out why this is happening.
One thing that's different about our setup in our development environment is that instead of creating a separate virual directory just for this solution, we dropped it into an existing directory that runs a classic ASP application. So here we have a folder with an ASP.NET 2.0 application within a directory that contains a classic ASP application. Granted, everything in the ASP.NET 2.0 application works if all of the code is within the .asmx file and not in code-behind, but we'd really like to know why it's not recognizing the code-behind files and compiling it correctly.
As others have mentioned, it's probably a better practice to build the solution as a "Web Application Project." This way your code will be precompiled to run on the server.
The following solution worked for us: In IIS, navigate to the folder in your website that contains your solution. Right click on the folder and choose Properties. In the Directory tab, under Application Settings, click Create to make the folder into an application (I believe this can also be accomplished simply by making the folder a Virtual Directory). Then, make sure your ASP.NET configuration is set to use ASP.NET Version 2.0. The problem we had was that the larger directory was running under ASP.NET 1.0, so we had to go through this step to have this directory use ASP.NET 2.0.
You may have a difference between a Web Site "project" and a Web Application project. In a web site project, all of the files are compiled dynamically. In a web application project, you have to build the code first.
You should be using Web Application Projects for web services. Use File->New Project and choose the appropriate project type. Then build your project and finally use the Publish command to deploy to IIS.
I'm not sure I can explain why its not working however placing Code behind files in the App_Code folder seems like a dodgy thing to do. App_Code files will get compiled into a single assembly. Hence the code in your code behind will end up in this assembly even though its not intended to.
I would first create a AddressValidation.asmx.cs file in the same folder as the .asmx folder and tweak the CodeBehind attribute of the asmx file. Remove the file from the App_Code folder and place its contents in the new .asmx.cs file.
Check this works in the XP environment then move it the destination server.

Resources