A puzzled ASP.NET developer asked on the ASP.NET Forums why the formatting of the same ASP.NET page looked different in Internet Explorer when rendered by Visual Web Developer & IIS seperately. When the entire source code is the same, why should they look different?
Dave Sussman has this insightful answer -
It's possible the application is running on IIS under a v4 application pool, meaning it will be run as though it were a v4 application, so the control rendering might be different. Two things to do:
1. On IIS machine, select the application and from the Actions tab on the right, select "Basic Settings ...". From the dialog that pops up, select the appropriate application pool (Classic .NET AppPool for an ASP.NET 2.0 application).
or
2. In Web.Config, in the <system.web> section add:
<pages controlRenderingCompatibilityVersion="3.5" />
That will ensure the controls are rendered as though the application was ASP.NET 3.5, so should be consistent on both machines.
A standard ASP.NET control may render a different kind of source depending on which Framework it targets. For instance, ASP.NET 4 brings the following major rendering changes:
Dave Sussman has this insightful answer -
It's possible the application is running on IIS under a v4 application pool, meaning it will be run as though it were a v4 application, so the control rendering might be different. Two things to do:
1. On IIS machine, select the application and from the Actions tab on the right, select "Basic Settings ...". From the dialog that pops up, select the appropriate application pool (Classic .NET AppPool for an ASP.NET 2.0 application).
or
2. In Web.Config, in the <system.web> section add:
<pages controlRenderingCompatibilityVersion="3.5" />
That will ensure the controls are rendered as though the application was ASP.NET 3.5, so should be consistent on both machines.
A standard ASP.NET control may render a different kind of source depending on which Framework it targets. For instance, ASP.NET 4 brings the following major rendering changes:
- The Image and ImageButton controls no longer render a border="0" attribute.
- The BaseValidator class and validation controls that derive from it no longer render red text by default.
- The HtmlForm control does not render a name attribute.
- The Table control no longer renders a border="0" attribute.
- Controls that are not designed for user input (for example, the Label control) no longer render the disabled="disabled" attribute if their Enabled property is set to false (or if they inherit this setting from a container control).
Also see:
0 comments:
Post a Comment