I just publish an asp.net website then i made changes in its source code i added two .aspx files and then publish it again
The question is what I need to make this changes take effect on server. Do I have to replace all files or i can just add specific file?
I'm trying to add two aspx pages to the site that already exist on the server
and want to know which file i have to add beside the ordinary aspx file to take effect on site
Thanks
This depends on how you are deploying your code. Are you using the precompile option before publishing or just publishing with pre-compilation.
If you are just publishing then you can just replace the .aspx and aspx.cs files and the site will dynamically recompile.
If you have pre-compiled it then you are probably only left with .dll files and .aspx files so you would have to deploy a new copy of the .dll file for your site and the .aspx files. MSDeploy replaces the entire site by default.
If you have only changed the aspx file and not the code behind it is enough to publish those two files and on the server. If you have changed the code behind as well you also need to publish the dll files, in that case it's probably easier to replace all of the files.
Related
I received the below ASP.Net project. I need to understand the working of this webserver from its code. Where should I start exploring this project from I am a newbie in ASP.Net and C#. Which file among the below will contain the server listening command?
Project Structure
.cs files are the "C-Sharp" code behind files. The ones in the AppCode folder are likely relevant to the project. You should also investigate the "Default.aspx" and associated "Default.aspx.cs" file. This is the default webpage and code-behind file. This does appear to be webforms at first glance. Also, your "web.config" file will likely have server/application configuration information in it. The ".sln" file is your solution file.
That is essentially the File that you can use to open in visual studio, and it should pull in the necessary configs/files to build the project. Open the files up and start exploring.
I have created a website and deploy it on the IIS server. I want to change some code on the
the default.aspx. After I change the code on my own computer. I copy the default.aspx and default.aspx.cs file to the server. But seems don't work on the server. But the website work perfectly on my own computer. I would like to ask do I need to copy files other than the default.aspx and default.aspx.cs? Thank you
Depending on the project type, you need to deploy the assembly into which the changes were compiled. If this is a web application, the web project should have a corresponding DLL.
Is it a web site or a web application project in VS? It sounds from your brief description that it maybe a web application (code behind file) so once C# code has changed then you will need to compile it put the default.aspx and the newly compiled dll up on your hosting.
HTH
You also need to compile your solution and put latest dll of the project containing Default.aspx file, in server's bin directory, since you have made changes to code behind file Default.aspx.cs.
upload dll if you change code behind and aspx if you change design
load your page on browser,if nothing has change press "ctrl + f5" to clear cache and refresh your page
I'm having a "tiny" issue with my App_Code folders.
I'm learning ASP.NET and, therefore, ordered a webserver with the support of ASP.NET 4.0. I'm using Visual Web Developer to program my webpages. When I upload my website to this webserver everything runs fine.
However, if I then add another web project to my server, my App_Code folder gets all messy. The server wants all my class files in the App_Code folder in the root. Is there any way I can create subdirectories in my App_Code folder or something to keep my projects organized or am I missing the point here?
You should take a look at codeSubDirectories in the web.config
Alright I found a solution to my problem. Although most of your answers might work aswell, this proved to be the best in my case. I created a subdomain and threw all files into that folder and it worked fine.
You should try to avoid using the App_Code folder for your own stuff, especially if you're using a web application project.
Whenever you convert a website to a web application project, the process actually renames your existing App_Code directory to Old_App_Code.
See Here, even though this is specific to converting .net 2.0 apps, I believe it still holds true in 4.0 since converting a 4.0 app does the same thing.:
VERY, VERY IMPORTANT: Because ASP.NET 2.0 tries to dynamically compile any classes it finds under the /App_Code directory of an application at runtime, you explictly DO NOT want to store classes that you compile as part of your VS 2005 Web Application Project under an "app_code" folder. If you do this, then the class will get compiled twice -- once as part of the VS 2005 Web Application Project assembly, and then again at runtime by ASP.NET. The result will most likely be a "could not load type" runtime exception -- caused because you have duplicate type names in your application. Instead, you should store your class files in any other directory of your project other than one named "app_code". This will be handled automatically by the "Convert to Web Applicaiton" command. This command will rename the folder Old_App_Code.
If you have access to a hosting control panel it's probably best to configure your hosting environment with a virtual folder for your second website and run it from the sub folder, e.g. www.example.com/project-b. The first site can still be running in the root folder, e.g. www.example.com.
So both sites will essentially be isolated from each other (just like they are now isolated as two separate projects in Visual Web Developer Express). And both sites have their own App_Code folder (and web.config file).
If you don't have access to a configuration panel, most hosting providers are willing to add a virtual folder for you, since it's really not a special requirement.
The virtual folder should show up as a regular folder in your FTP folder, usually inside the www or wwwroot folder. Now you can copy your project files into that folder.
Take care to use root-relative paths for URLs in your second project, so all links will work even when the website is run from the subfolder. Root-relative URLs look like this:
<asp:HyperLink runat="server" NavigateUrl="~/Default.aspx" />
<asp:Image runat="server" NavigateUrl="~/images/logo.png" />
This will automatically go to www.example.com/project-b/Default.aspx and www.example.com/project-b/images/logo.png when the website is deployed in the virtual folder.
If you need to re-use code from one site in the other, it's typically best to move such code into a separate Class Library project type, and then add a reference to that project to each website project (right-click the website project, choose Add reference..., then select the Projects tab and select the Class Library project).
I am able to execute my application fine using the Visual Studio IDE but when I create a release package and put it on the web server it can’t seem to find the code behind. However, if I copy the bin folder (which has the dll files) from the root directory and put it into the “root/reports” directory, everything works fine. The reports directory has all the .aspx web page files. What is causing this problem and what can I do to properly fix this problem?
Since you have published your website, that means your code files were compiled into a DLL. To work properly you have to put your DLL's into the bin folder on your host server.
For Details, Check this link:
An Overview of ASP.NET Code Generation and Compilation
I have a folder that contains ASPX code and its codebehind (C#) as well as a solution file. The compiled version of the application resides in the inetpub directory.
Whenever I open the solution in Visual Studio, VS warns me that it is attempting to open a precompiled website and asks me if I want to continue. If I click NO it does nothing, but If I click yes it shows me the ASPX files in the inetpub directory.
How do I make the solution work with that code in the directory that it is in (ie with the aspx and codebehind)?
Thanks
Sounds like this solution was created by going to File->Open->Web Site and then saved afterward. In orther words, this is not the original solution file.
I suggest simply creating a new solution. Add the exisitng .csproj if appropriate (ie, you have a Web Application Project), or the existing web site from the directory your code is in.
Before you open your solution try opening your .sln file in Notepad or some other editor and double check that your web site path is right.
Debug.AspNetCompiler.VirtualPath = "/Url..."
Debug.AspNetCompiler.PhysicalPath = "Physical Path from the solution file\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\this might be the same as your physical path?\"