Response.write in IIS integrated mode

301 Views Asked by At

I have been working on an asp.net project that must work in integrated mode on IIS 7.5.

When I use Response.write("sometext"), IIS wraps my texts with waste HTML tags.

Look at this code:

protected void Application_BeginRequest(object sender, EventArgs e)
{
        Response.Clear();
        Response.ClearContent();
        StringBuilder sb = new StringBuilder();
        sb.Append("<html>");
        sb.Append("<head>");
        sb.Append("</head>");
        sb.AppendFormat("<body>");
        sb.AppendFormat("some text");
        sb.Append("</body>");
        sb.Append("</html>");
        Response.Write(sb.ToString());
        Response.End();

}

I exepct receive this from server:

<html>
<head>
</head>
<body>
sometext
</body>
</html>

but the server gives me this:

 <html> 
 <head>
 </head>
 <body>
 <pre>
      <html><head></head><body>sometext</body></html>
 </pre>
 </body>
 </html>

What's the problem??

Application works fine in VS web developer server or IIS ( in classic mode ).

1

There are 1 best solutions below

0
Hedayat Allah Kamalian On BEST ANSWER

after two days accidentally i founded if use Response.Flush(); command the IIS can't wrap the response