Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

HTTP Header / ASP .NET problem - need help.

Back to Forum: Tech Off
  • User profile image


    I want to develop a HttpModule which adds a CUSTOM HTTP Header "Response.AddHeader("X-MyHeader", "testvalue")". But why I cannot get the header in the next request ?! I´ve tested this way: request.Headers[..] and request.Servervariables["ALL_RAW"]. But I doesn´t get my own defined HTTP Header back from the client. Is it possible - or what I´m doing wrong ?

  • User profile image

    Thats not how HTTP works.

    When you set the header, it is sent back to the client with the rest of the HTTP headers (eg HTTP status code, caching info, cookies etc).

    When the client sends the next request, it will NOT include your header. The headers are purely response headers and are only used by the browser to decide how to handle the page. They are forgotten as soon as the page has been loaded.

    If you wish to save information on the client between requests, use a cookie.

  • User profile image

    or in the url like the cookieless session. Smiley or perhaps in the viewstate ?!

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.