asp.net unpublishing - asp.net

I published my web application to a folder , after I hosted that folder on a server,but my project codes are broken.Now I will republish(unpublisch) my application from the publish folder. I will see my aspx page's .cs codes.how can I see

you have no choice to unpublish your code. While you work on the project before publish u have to take the copy of the project. while publishing ur codes are converted to dll. no way to recover ur codes from the dll.

Related

ASP .Net Web App not publishing .cs files and Database

I have a web portal app. I built it in Asp .Net. The app is now ready but when I try to publish it using Visual Studio, I only get the .aspx and .css files. It does not include the .cs files that have all the backend code and functionality, and it does not include the database either. The method I used for publishing the app was:
Right Click my project -> Click on Publish -> Select IIS,FTP,etc -> Select File System and provide Target Path -> Click Save.
It published the app at that targeted location. But, when I open that folder, I can only see the .aspx and .css files and no .cs files, as you can see in the following screenshot.
https://drive.google.com/file/d/15pecp8tbamjlWCm4rfV6M_zeW7zdUUB9/view?usp=sharing
At first, I thought maybe this is how it publishes the app, as this is the first time that I have tried to publish a web app. Therefore, I loaded it to IIS as it is, and tried to browse it. When I browse it, it loads the first page, that is a login page, correctly. But when I enter user credentials and try to login, it provides me with following error:
https://drive.google.com/file/d/1TIC0gE1tFpcne4bXaSsEVm8yiOPnIyOt/view?usp=sharing
I have underlined the lines by which I got the idea that the error is related to database and .cs files.
Please, if anyone can help me about this, it will be really appreciated. I have a deadline and I dont have any idea that how can I solve this problem.
Thanks.
When you publish your web application the visual studio compiles all your your cs/vb/class code into binary files (dll), this dll files can be found in your site bin folder, so you can't find the .cs file.
There are many causes of the network path was not found which are given:
1.Antivirus 2.Firewall 3.SQL Server Network configuration.
and please check if you have the port in the connection string "Data Source=x.x.x.x,1433".
More information about this error you can refer to this video:Resolving SQL Server Connection Errors
For a web application your .cs files are compiled into a DLL which will be in the bin folder.
The special App_Code folder can be created and the .cs files in there will no be compiled during publish and will be compiled by IIS on demand.

Which files need to be deployed on IIS when you republish code?

I have an ASP.NET application with published code running in IIS. Now I've made some changes to the application pages and republished the code.
Which files/folders do I now need to redeploy on IIS?
It depends, if you've made changes in C# class library, then you will need to update just DLLs. And if you've changed aspx or aspx.cs file the you will need to update that published page.

From what parts does the built Asp web forms application consists?

Can't google with a success an info about: from what parts does the built Asp web forms application consists? In a Debug folder I see only dlls, but as far as I understand the aspx pages and a web.config file should exist. Any links?
The BIN folder contains the compiled code behind. The ASPX pages and web.config stay in the same place, the root directory of your application.
Further reading:
ASP.NET Web Project Folder Structure
How to: Publish Web Application Projects
Asp applications, unlike windows forms applications need to be published first.
Right click on your project and click publish. From there pick file system option and publish to wherever you want on your computer.
Those files are the ones you upload to ftp server.

Persist a reference in ASP.NET web site

We have VS2010, ASP.NET 4.0 web site (not web project). Multiple developers work on it. I need this site to reference AjaxControlToolkit.dll. So, I checked in AjaxControlToolkit.dll into source control, then right-clicked on the web site, went to Property Pages, References, clicked Add, then added AjaxControlToolkit.dll.
As a result of my action, AjaxControlToolkit.dll was copied to BIN folder of the web site. So, all works fine on my machine. But, I see no record anywhere in the solution or project files that AjaxControlToolkit.dll is referenced from the web site.
Since we don't check in BIN folders or any .user or .suo files into the source control, when another developer gets latest, AjaxControlToolkit.dll is missing from the BIN folder and he/she gets an error until he/she adds the DLL to the BIN folder.
Is there any way to add a DLL reference to a web site and have that reference persisted on different machines?
Thanks.
At my current company, we create a folder in the project called "ReferencedAssemblies". All external (non .NET) assemblies are located in and referenced from this folder.
This way, you also guarantee that any updates to an external assembly are present whenever a developer performs a "Get Latest" or when the project is deployed.
HTH.
Web sites don't have project files which is where you would typically find references so you will not be able to reference the assembly other than having it in the bin of the web site or in the GAC of the machine where the site is running.
The only references that you will find to assemblies in a web site are the add assembly tags in the web.config, the register tags in pages and user controls, and the licenses.licx file if you are using controls that require licensing such as Infragistics.
Your options are to either set up all of the development machines to already have the assembly or to use a WebApplicationProject so that you can add a folder with the assemblies and add the references to the project with either a hint path set or a reference path set in your project so that visual studio can find the assembly.
You can store the referenced DLL in a 'References' directory that is source controlled then put the relative path to it inside a [dll name].refresh file in the website's /bin folder. Also source control the .refresh file.
Everytime Visual Studio compiles your ASP.NET website, it'll use the .refresh file to find the DLL in the 'References' directory and copy it to your /bin folder.
So for example, if your website references ThirdParty.dll, Set up your structure like so:
\References
\ThirdParty.dll
\MySite
\bin
\ThirdParty.dll.refresh
Then in ThirdParty.dll.refresh have this line
../../References/ThirdParty.dll

Use CodeBehind instead of DLL

I want to add new pages to a website without being have to recompile the whole site and copy the new dll to the bin folder.
I just want to upload the aspx files + the cs files.
Right now, when I try to do it the page won't load.
If you are working with a Web Application Project, you have to compile and copy the dll and aspx files.
In your case you could also use a Web Site project. ASP.NET will compile your code while it's being accessed so you can only deploy new aspx and cs files.
Here you can find an overview of the differences between Web Application Project and Web Site Project and also a few hints on when to choose which.

Resources