HttpContext.Current.Response.Headers error in Vs2005

Last post 11-16-2009 5:56 AM by Amir110. 2 replies.

Sort Posts:

  • HttpContext.Current.Response.Headers error in Vs2005

    11-13-2009, 12:29 PM
    • Member
      point Member
    • Amir110
    • Member since 02-11-2009, 9:16 AM
    • Posts 6

    hi

    i want to add some cutom headers in response time but whenever i try to us this line of code i face with this error

    'System.Web.HttpResponse' does not contain a definition for 'Headers'

     

    public void LoadHeaders()
            {            
                this.mHeaders = new NameValueCollection();
                this.mHeaders.Add(HttpContext.Current.Response.Headers);
            }

     

    i am googling this error but i can not find anything

    another this is that i don't know this property exist in asp.net 2.0 or not if exist how i can use it in VS2005 and dotnet2.0?
     

  • Re: HttpContext.Current.Response.Headers error in Vs2005

    11-15-2009, 12:29 AM
    • Contributor
      5,228 point Contributor
    • RickNZ
    • Member since 01-01-2009, 8:43 AM
    • Nelson, New Zealand
    • Posts 873

    If you just want to add a custom HTTP header, have you tried something like this:

    this.Response.AddHeader("MyHeader", "value");
    



  • Re: HttpContext.Current.Response.Headers error in Vs2005

    11-16-2009, 5:56 AM
    • Member
      point Member
    • Amir110
    • Member since 02-11-2009, 9:16 AM
    • Posts 6

    hi Rick

    i need to load all response headers into local variable named headers in my class and in time of need i must add them to response header.this is becaus i want them to use in Cashe out put and filtering.

    i see some people using that in their code but i don't know why i can't use it.

     

    could you say me there are no way to get this collection in dot net 2.0 with this way?  or if there are solution i need it

     

    best wishes

Page 1 of 1 (3 items)