« Previous Next »

Thread: How to find Content-Type in IIS Filter module?

Last post 02-25-2009 3:16 AM by Andrew Zhu - MSFT. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 02-18-2009, 10:20 AM

    How to find Content-Type in IIS Filter module?

    Hi,

    I have one doubt regarding the Character-Set. I have written one small IIS filter module to fetch the name from query string and display it through our filter. However there is a problem as the characters in query string can be in different character-sets so I need to decode it keeping the Character set in mind. Till here the logic looks fine.

    Now the actual problem starts here is that the HTTP Request does not have "Content-Type" header. How can I find the Content-Type of the requested page?

    Is there a way to find the default Content-type header defined for Virtual Web Server. 

    As far as my understanding, the IIS will add the response header once it starts rendering the page. And if the page does not have tag<meta htt-equiv="Content-Type" content .. >, it will set the "Content-Type" header to Default.

    In my case our filter intercepts the request, so no rendering has started yet. Please let me know how to find the "Content-Type" for partially/not processed web pages from filter.

    Am I looking at wrong header, please correct me. 

    Thanks,

    Neha

     

     

  • 02-23-2009, 7:21 AM In reply to

    Re: How to find Content-Type in IIS Filter module?

     Any help?

  • 02-25-2009, 3:16 AM In reply to

    Re: How to find Content-Type in IIS Filter module?

    Hi, Neha

    You can not ascertain Character-Set of the query string by examine by header elements (Accept-Charset in Request header, Content - Type in Response header). if the query string use other Character-Set,which is encoded in the client broswer. Usually, charset is "UTF-8".

    here is a link about globalization of ASP.NET

    http://msdn.microsoft.com/en-us/library/hy4kkhe0(VS.80).aspx
     
    Regards

     

    Sincerely
    Microsoft Online Community Support
    Andrew Zhu - MSFT


    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
Page 1 of 1 (3 items)
Microsoft Communities