« Previous Next »

Answered Thread: Adding Custom HTTP Header to sub directory

Last post 11-02-2009 3:37 AM by Leo Tang - MSFT. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 10-28-2009, 2:29 PM

    Adding Custom HTTP Header to sub directory

    here is my code i am trying to add a custom http header to the sub directory of my web site is it possible to do this ta Gerard Dim IISOBJ, CustomHeaders, Parts, HeaderName, HeaderValue 'Get the mimemap object. Set IISOBJ = GetObject("IIS://LocalHost/W3SVC/1/root/test/css") CustomHeaders = IISOBJ.HttpCustomHeaders if (ubound(CustomHeaders) = -1) then Redim CustomHeaders(0) Index = 0 else Redim Preserve CustomHeaders(UBOund(CustomHeaders)+1) Index = UBOund(CustomHeaders) end if HeaderName = "Testing" HeaderValue = "123456" ' Note: I beleive the space after the : is required! CustomHeaders(Index) = headerName & ": " & HeaderValue IISOBJ.HttpCustomHeaders = CustomHeaders IISOBJ.SetInfo WScript.Echo "Header Value" WScript.Echo "==========================" 'Display the mappings if (ubound(CustomHeaders) = -1) then WScript.Echo "No custom headers defined for this web site" else for pos = lbound(CustomHeaders) to uBound(CustomHeaders) Parts = Split(CustomHeaders(Pos), ":") WScript.Echo Parts(0) & space(20-len(Parts(0))) & Parts(1) next end if
  • 10-29-2009, 5:31 AM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Adding Custom HTTP Header to sub directory

    Hi,

    Can you pls paste again with line breaks:)?

    Follow me on twitter at http://twitter.com/kjsingla
  • 11-02-2009, 3:37 AM In reply to

    Answered Re: Adding Custom HTTP Header to sub directory

    Hi,

    You can use the scripts above to add a custom http header.

    gerardflynn:
    ' Note: I beleive the space after the : is required!
    The space is not necessary
    gerardflynn:
    space(20-len(Parts(0)))
    If the customer header's name contains more than 20 characters, you will encounter an error.

    You can run WFetch to check the response headers returned by IIS.
    WFetch 1.4
    http://www.iis.net/downloads/default.aspx?tabid=34&i=1307&g=6

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (3 items)
Microsoft Communities