Contents of a code-behind file is rendered instead of a control - asp.net

I have a user control which is being added to a page dynamically. It works fine on my computer whether a site is running on an integrated Visual Studio server or deployed to IIS.
But when the site is deployed to a production server, I see the contents of a user control's code-behind file instead of a control.
Have you any ideas what can cause this?
Thank you.
EDIT: The site is running on IIS 6 and here is the code I am using to add the control to a page
`this.Controls.Clear();
this.Controls.Add(LoadControl("MyUserControl.ascx"));`

Yikes. That should never happen. Are other ASP.NET pages working correctly? Are you sure ASP.NET is properly registered on the server? I think you'll need to give us some more information... what version of IIS are you running, and post the code where you dynamically add the user control.

Related

Does change in ASPX. CS page requires building.

During my previous projects, any change that I would make to an aspx.cs didnt require building the entire solution. The changes would directly reflect in my IIS hosted server i.e in localhost.
the new web application has the same setup configured. The application has been added in IIS with a designated Application pool and when browsed the site opens. But in this project, I have to build the solution everytime I make change in aspx.cs page. The same doesn't apply to aspx changes.
Any help would be appreciated in letting know this difference in behaviour and solution of not building the entire solution if possible.
Thanks

IIS not running *.cs code

I have deployed asp.net web forms website on windows server 2012 and linked with a subdomain (using Plesk panel).
Now, the website is not running any code-behind files even the Page_Load is not being called.
For testing purposes, I added the javascript alert in Page_Load; it didn't show any message, but it did show when I added alert in *.aspx file, it did show.
I didn't get the actual reason, but seems like IIS configuration error may exist.
Help me resolve the issue, will be appreciable.

Master Page Not Loading Properly

I have spent a couple days trying to figure out why my asp master page format and controls are being ignored when I try to access a page from my IIS 7.5 server.
I'm using the basic DevStudio ASP web project and everything works when I reference the pages through localhost. But when I try to access it through the server the asp:Menu control in the master page, and any other formatting, is being ignored.
I turned on logging and the only thing I see is a warning that I'm getting access denied to the style sheet. I've added the style sheet folder to the IIS list of virtual directories - still not working.
Any help in resolving this issue will be greatly appreciated.
ApplicationPool of your hosted website may not have the permission to access the files. Check the applicationpool credentials. If the controls not loaded properly, check the DateTime of your IIS server machine.If the future date time is set, you will get this kind of misbehavior.

Changes in aspx files won't show until rebuild

As I understand it, I should be able to change an aspx file in VS, update in the browser and then see the changes without rebuilding the entire solution. For me thats not the case...
Any ideas?
Edit:
I use VS 2008, .NET 3.5 and development server. It is a Web Application project and I always need to rebuild to see the changes in the aspx files. I use master pages and aspx controls. I use edit and continue and have no problem updating the code behind files without rebuilding.
If the change is affecting code behind in any way, you need to rebuild.
If not, can you give an example of what you change so we have a little more to go by ;)
If you are using the Web Application Template (versus the web site template) and you add controls to the aspx front-end code, it will automatically add it to the <file_name>.cs.designer partial class auto-generated code behind. since this is part of the class, it needs to be compiled.
I think you need put more information into your question, like what change are you making? What version of IIS are you using? Are you using IIS or Cassini (Visual Studio Web Development Server)?

What can cause ASPNET AJAX page to revert to normal ASPX mode ? / UpdatePanel broken

I am using VS 2008 with a very simple UpdatePanel scenario.
But i cannot get UpdatePanel to work and cant seem to find out why
I have in fact reverted to a very simple example to validate it is not my code:
http://ajax.net-tutorials.com/controls/updatepanel-control/
In this example I click on either button and both text links update.
I dont get any errors, the page just behaves like a normal ASPX page.
What things do i need to check. I've been googling this for an hour and not found what I need.
Edit: Works in Visual Studio web server but not in IIS
If it's working locally, but not when deployed to a remote server, that usually indicates that you're using ASP.NET 2.0 and the ASP.NET AJAX extensions aren't installed on the remote server.
If it's a server you have administrative control over, you can download the installer here: http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en
If it's a web host, tell them to get their act together.
Another option would be to check your web.config. You could for example create an new Ajax enabled ASP.NET website from Visual Studio. This will generate a correct web.config. Copy over all non-ajax sections from your existing web.config and you're set. This worked for me.
-Edoode

Resources