Reputation: 4733
I have deployed an ASP.NET Web Forms application to an IIS7 web server. It works perfectly as long as the setting in the Compilation section of Web.config is debug=true
. As soon as I change it to debug=false
, which I understand is what I'm supposed to do when the application is live, pages don't render correctly.
Specifically, a page which has a Panel that is associated with a ModalPopupExtender loads with the controls that are inside the Panel displayed right from the off. It's not that the Panel is displayed when it shouldn't be, it's that the controls from inside the panel are rendered as if they're not inside the Panel, leading to controls scattered randomly across the page.
As soon as I set debug=true
again, the problem goes away.
EDIT: After further playing around, I've discovered that even if debug=true
is set in web.config, if I set the ScriptMode
property of the ToolkitScriptManager on my page to Release
, that too causes the same incorrect behaviour of my ModalPopupExtender enabled Panel. So, for things to work properly I have to have debug=true
in web.config and ScriptMode=Debug
in a page's ToolkitScriptManager. What's going on? Don't Microsoft want me to release my application?
ADDITIONAL INFO: My Web.config file shows that I'm targeting version 4.5 of the .NET Framework, and whilst looking at the Application Pool in IIS seems to show that my applications on the web server are all using version 4, I'm not especially proficient with IIS, so I've posted a screenshot below. And would this cause the problem I'm experiencing anyway?
Upvotes: 3
Views: 1356
Reputation: 3625
There should be a conflict between your Application Pool version and your config file. Maybe you are using v4.0 App Pool, and your web.config is configured for v2.0 or vice versa.
Please check your versions and leave a comment with this answer and let's check. :)
--EDIT--
You may have 3 options:
Set the panel's style display to none:
< asp:Panel ID="panel1" runat="server" style="display: none;">
Upvotes: 1
Reputation: 225
While this isn't a direct solution to your problem that you are asking about, you can hide the panel on page load (not post back) for any pages that have this issue. I have seen this be used as a workaround in the past for the ModalPopupExtender showing controls on page load in different scenarios. This should prevent the controls from being rendered on the page inappropriately but still work for when it needs to pop up.
protected void Page_Load(object sender, EventArgs e) {
if(!Page.IsPostBack)
pnl.Visible = false;
}
I have also found that getting the latest version of .NET framework on your machine that hosts the website fixes a lot of issues like this.
Upvotes: 1