I hardly use web services, but just noticed now when I created one, the CS file was dumped in the App_Code folder. Is that a new thing?
I always thought it behaved much like an Aspx or Ascx file with the nested code behind CS file.
That's because you are using a Web Site in contrast to Web Application. Web Sites are compiled dynamically at runtime by the ASP.NET runtime. In this model all code goes into the App_Code special folder. When deploying you need to upload your source code as well.
On the other hand a Web Application is compiled. You can place the code wherever you like and for things like .ASPX, .ASCX, .ASMX, .ASHX, ... Visual Studio nests the code file next to the markup.
Related
is it possible to deploy all codebehind files to a webapplication in addition to all resource files in the bin folder. In such a manner that it will generate the website binary dynamically similarly to how a website works?
We have a asp.net 4.5 vb.net webforms application which we would like to deploy to certain customers in uncompiled mode so custom changes can be made. Is this possible? and if so what is it in either the IIS metadata or the web.config e.t.c. which tells IIS that it should generate the binary itself?
Update typo webforms not winforms :)
A "Web Application" project cannot be deployed like this, however a "Web Site" project can. Have a look at the differences between the two here:
http://msdn.microsoft.com/en-us/library/dd547590(v=vs.110).aspx
Much more information on this subject is contained in this SO question: ASP.NET Web Site or ASP.NET Web Application?
I came across this post while looking information for pros and cons of using this specific way of deployment as I have been doing this myself for quite sometime now. This can be possible if you deploy both your .cs file and .aspx files in the website folder but make sure your .aspx file is directed to .cs file instead of dll file while running. I have been doing this for sometime, where I need some features customization for client and use code file for that specific page only.
aspx file:
<%# page title="" language="C#" masterpagefile="~/School/MasterPage.master" autoeventwireup="true" CodeFile = "academicdashboard.aspx.cs"inherits="School_AcademicDashboard" %>
code file:
public partial class School_AcademicDashboard
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.
I downloaded the file discussed in this article and tried "dropping it into" a production web site, but got the following error when I tried to access it through my Web browser:
[HttpException (0x80004005): The file '/WebResources.aspx' has not been pre-compiled, and cannot be requested.]
If I drop the file into webs on my local machine, it runs fine. How do I pre-compile this single file without re-publishing the whole application? Is there something that I can do to pre-compile just this one page. (Note: It doesn't reference any external controls, Masterpages, etc.)
One lazy solution for your problem (without checking the source of the error) is to view the page inside an iFrame.
<iframe src="/WebResource.aspx" width="100%" height="100%">Your browser does not support iFrame</iframe>
but if you need that page to interact with controls outside of its scope, then you will need to look into the header part of the ASPX and make sure that it inherits from the proper class, and is part of the Web Project that is calling the page.
This is pretty easy to do.
Put the file into it's own web application project.
Publish the project to a local directory.
Copy the file and associated assembly to your existing web application. Take care NOT to overwrite your web.config.
Done. This new file now has access to everything your other web app does.
I have precompiled my code and added it to my webserver but when I try to access the page
I am getting this message
This is a marker file generated by the precompilation tool, and should not be deleted!
How do I remove this so I can see my page?
It seems you have deplyed a precompiled asp.net application. Did you remember to copy the generated assemlies (bin directory)?
Precompiled websites uses empty aspx files for routing hooks (unlike the mvc routeing engine). This is why you have a bunch of "empty" aspx files.
I am trying to shift my asp.net 3.5 application (C#) to sharepoint.
I have used one .ashx(web handler) file for multiple file upload control in my application
Now it works perfectly locally in asp.net but when i do the same thing with sharepoint with no change in code it stops working.
I dont know if i need to add some dll or any supportive file to get that file upload page (using .ashx file) working in sharepoint
Please help
Your are not adding your handler to sharepoint's web.config ...
like
see my post for what i did to make it work Custom Httphandler in SharePoint