Microsoft KB Archive/828978

= PRB: Setting the HTTP Header in the  Section Does Not Work in ASP.NET 1.1 =

Article ID: 828978

Article Last Modified on 4/19/2007

-

APPLIES TO


 * Microsoft ASP.NET 1.1

-



SYMPTOMS
In Microsoft ASP.NET 1.1, when you set the HTTP header value in the  section of a Web.config file, the set value does not work as expected.



WORKAROUND
To work around this problem, set the value of the isMobileDevice property to true in the  section of the Web.config file as follows: 

 isMobileDevice=&quot;true&quot;   browser = &quot;Testing browser type&quot;  



STATUS
This behavior is by design.



Create an ASP.NET Web Application
 Start Microsoft Visual Studio .NET. Use Microsoft Visual C# .NET or Microsoft Visual Basic .NET to create an ASP.NET Web Application project that is named TestWeb1. By default, WebForm1.aspx is created.</li> Right-click the WebForm1.aspx Web form, and then click View HTML Source.</li>  Replace the existing code with the following code:

Visual C# .NET Code <%@ Page language=&quot;c#&quot; %> WebForm2 <SCRIPT runat=server> public void Page_Load(Object sender, EventArgs e)    { Response.Write(Request.Browser.Browser); }   </SCRIPT> <body MS_POSITIONING=&quot;GridLayout&quot;> <form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;> Visual Basic .NET Code <%@ Page language=&quot;vb&quot; %> WebForm2 <SCRIPT runat=server> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Response.Write(Request.Browser.Browser) End Sub </SCRIPT> <body MS_POSITIONING=&quot;GridLayout&quot;> <form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;> </li></ol>

Modify the Web.config File
<ol> In Notepad, open the Web.config file for the ASP.NET Web Application project that you have created.</li>  To override the HTTP header for the browser variable, add the  section to the  section as follows: 

 <use var=&quot;HTTP_ACCEPT_LANGUAGE&quot; as=&quot;accept_language&quot; /> <case match=&quot;en-us&quot; with=&quot;%{accept_language}&quot;> browser = &quot;Testing browser type&quot; </browserCaps> </system.web>

</li> Save the Web.config file.</li></ol>

Run the Application

 * 1) On the Debug menu, click Start to run the application.
 * 2) You notice that the value IE is displayed in Microsoft Internet Explorer, and that the value Netscape is displayed in the Netscape browser. However, the expected value is Testing browser type.

<div class="references_section">