Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm in the middle of switching our site over to a new web server (Server 2008 R2), and am trying to copy one of the new applications to the old server (Server 2003) in order to let users access it in the meantime. The problem I'm running into is that even though I copied the folder over directly to the old server, started the app on the old server, and set the ASP.NET version to 4.0 to match what it's using on the new server, the old server displays the page differently. Specifically, the CSS styling (located in the head) that sets the font size and type is not utilized on the old server. On another page, a textarea is not displayed in the dimensions specified in the ASP.NET page; the style info just doesn't make it to the source code of the resulting page.

For example, here is the line of code in the aspx file:

<td colspan="3"><asp:TextBox ID="cre_slm_comm1" runat="server" Height="156px"
    TextMode="MultiLine" Width="400px" Text='<%# Eval("cre_slm_comm1") %>' /></td>

This is the resulting source code on the IIS6 server:

<td colspan="3"><textarea name="FormView1$cre_slm_comm1" rows="2" cols="20"
    id="FormView1_cre_slm_comm1">Test comment. 3/1/13. br.</textarea></td>

And the same line on the IIS7.5 server:

<td colspan="3"><textarea name="FormView1$cre_slm_comm1" rows="2" cols="20"
    id="FormView1_cre_slm_comm1" style="height:156px;width:400px;">
    Test comment. 3/1/13. br.</textarea></td>

Any suggestions on what I can do to fix the way these servers are not interpreting the code the same way?

share|improve this question
    
If its not used on the old server. Wouldn't the logical solution be to remove it? –  Ramhound Mar 1 '13 at 16:42
    
Belongs on serverfault.com. Also try using v2 of the framework? –  Ian Quigley Mar 1 '13 at 16:43
    
Ramhound: I don't understand your comment. Ian: The page works fine using .net 4.0 on the IIS7.5 server. It's using 4.0 on the IIS6 server as well. Why would switching to v2 make a difference? –  Ben Mar 1 '13 at 16:54
add comment

migrated from stackoverflow.com Mar 2 '13 at 0:19

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 2 down vote accepted

Change the site application pool in IIS to target the same .NET Framework version and Pipeline of the other server.

or add this line in web.config:

<pages controlRenderingCompatibilityVersion="3.5" />

ASP.NET 4 Breaking Changes

Asp.net adapts the rendered html according to browser kind and version. check if it is related only to a browser.

If the problem persist maybe this could be a .net bug or the 2 server have some difference in the framework version(some patch etc etc).

Anyway an easy workaround and a best-practice IMHO is to use a css class to style an element.

share|improve this answer
    
That line is already present in the web.config, and the framework is 4.0 on both (stated in OP.) –  Ben Mar 1 '13 at 16:52
    
@Ben really strange... are you using different browsers? App poll is in Integrated pipeline or classic? –  giammin Mar 1 '13 at 16:56
    
Giammin: Nope. IE10, two different tabs. I've got the page pulled up on the new server in one and the old in the other. IIS7.5 looks the same both in integrated and classic mode (though I've got it using integrated.) The IIS6 server is just interpreting the aspx differently and losing some of the styling in the resulting source as a result. I'm not sure what would cause that, however. –  Ben Mar 1 '13 at 16:58
    
@Ben this is an asp.net behavior. It is adapting the rendering of html elements. –  giammin Mar 1 '13 at 17:01
1  
There were a few things that were broken--it was a single element on each of three pages, specifically--so I did end up taking those style elements out of the element attributes and assigning them to a css class for each element. I'm not sure why it was necessary--apparently IIS6 just wasn't translating those attribute settings properly into the HTML rendering--but it works as-is, which is really what's important anyway. Thanks! –  Ben Mar 1 '13 at 17:42
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.