locked
WindowsServer2003, IIS6.0 and Sharepoint2007 adding custom Headers in web.config file of webapplication RRS feed

  • Question

  • Hi,

    IIS7.0:-

    In IIS7.0 If I choose a website and double click on it under IIS section I can see an Icon called “HTTP Response Headers” If I double click on it I can add new Http Header from ActionsàAdd. Once I add a custom header, I can open the sharepoint2010 website from IIS7.0 and when I navigate to it web.config file, I see that below entry is added under

    <system.webServer> section

    <system.webServer> <httpProtocol> <customHeaders> <add name=”X-UA-Compatible” value=”EmulateIE7″ /> </customHeaders> </httpProtocol> </system.webServer>

    IIS6.0:-

    But If I add the Custom HTTP header in IIS6.0 by going to website properties, and open the SharePoint2007 sites web.config file I cannot see an entry similar to above custom header added in IIS6.0 web.config file.

    Then where is this information stored in IIS6.0?

    If I have to manually add a custom header for a particular website hosted on IIS6.0 without using IIS6.0 UI. But by editing web.config file how can I do that?

     

    Thanks




    • Edited by vilas6_it Tuesday, April 10, 2012 12:14 AM
    Tuesday, April 10, 2012 12:07 AM

Answers

  • Hi vilas6_it,

    The Custom HTTP header Configuration does not be written in the Web.Config in IIS6.0. It’s saved in another location %windir%\system32\inetsrv\metabase.xml. You can find that the custom header HTTP custom header is stored like this

    <IIsWebVirtualDir            Location ="/LM/W3SVC/2143227628/Root"
                                    AccessFlags="AccessExecute | AccessRead | AccessScript"
                                    HttpCustomHeaders="MicrosoftSharePointTeamServices: 12.0.0.6219
                                                    X-Powered-By: ASP.NET"
                                    NTAuthenticationProviders="NTLM"

    But please don’t modify this file manually, you can configure the custom header by command line tool:

    Please run it from the c:\inetpub\AdminScripts.

    cscript adsutil.vbs set w3svc/1/HttpCustomHeaders "X-Powered-By: ASP.NET" "HeaderName2: value" "HeaderName3: value"

    Please refer to this document for more information on IIS Command-Line Administration Scripts.

    Thanks,


    Lambda Zhao

    TechNet Community Support

    Thursday, April 12, 2012 2:19 AM

All replies

  • Why are you trying to add a custom header?  You should be adding the desired URL as an "Alternate Access Mapping" through Central Admin

    Paul Turner http://redmanta.co.uk/blog Twitter: @RedMantaUK MCTS:WSS,MOSS,2010 MCITP:2010.
    Please remember to click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if it was useful.

    Wednesday, April 11, 2012 8:53 AM
  • Hi vilas6_it,

    The Custom HTTP header Configuration does not be written in the Web.Config in IIS6.0. It’s saved in another location %windir%\system32\inetsrv\metabase.xml. You can find that the custom header HTTP custom header is stored like this

    <IIsWebVirtualDir            Location ="/LM/W3SVC/2143227628/Root"
                                    AccessFlags="AccessExecute | AccessRead | AccessScript"
                                    HttpCustomHeaders="MicrosoftSharePointTeamServices: 12.0.0.6219
                                                    X-Powered-By: ASP.NET"
                                    NTAuthenticationProviders="NTLM"

    But please don’t modify this file manually, you can configure the custom header by command line tool:

    Please run it from the c:\inetpub\AdminScripts.

    cscript adsutil.vbs set w3svc/1/HttpCustomHeaders "X-Powered-By: ASP.NET" "HeaderName2: value" "HeaderName3: value"

    Please refer to this document for more information on IIS Command-Line Administration Scripts.

    Thanks,


    Lambda Zhao

    TechNet Community Support

    Thursday, April 12, 2012 2:19 AM