Wednesday, February 6, 2013

Make IIS not render pages as WML. Ever!

i have hosted my website on IIS server, sometimes my pages shows the html sorce code on the browser.

i was unable to understand WTF was really happening,

i was trying to findout the solution on google by searching queries like
- how to stop rendering html source code on browser or iis
....

after some time i came to know that is called a s WML .. .

and so on i have found this link..

1st solution
-------------

If you want a no-code/no-aspx change, you can add a browser capabilities file into the folder App_Browsers directly under your application root (if the folder's not there, just create it). To disable WML, simply put a file named ForceHtml.browser (anything ending in .browser) containing the following XML:

   refID="Default">
    
       name="preferredRenderingMime" value="text/html" />
       name="preferredRenderingType" value="html32" />
       name="preferredImageMime" value="image/gif" />
       name="tagwriter" value="System.Web.UI.HtmlTextWriter" />
    
markupTextWriterType="System.Web.UI.HtmlTextWriter" />
answered by Ruben

2nd solution
---------------------

We had this, and since we are using razor with html, the pages can't adapt automatically. For me, the simplest fix was to change the content-type in the _ViewStart.cshtml:
Response.ContentType = "text/html";
The "figure out the content-type yourself" insanity only happens when nothing is set explicitly. So... set it.
Your actual views can still override this:
@{
    Layout = null;
    Response.ContentType = "application/atom+xml";
}

answered by Marc Gravell

i have followed the 2nd solution today lets c is it fixing my problem or not ....


ref - http://stackoverflow.com/questions/1261144/make-iis-not-render-pages-as-wml-ever/5909281#5909281

No comments:

Post a Comment