need clarity -- Response.Clear, .ClearHeaders, .Buffer

Discussion in 'ASP .Net' started by matt, Nov 21, 2006.

  1. matt

    matt Guest

    hello,

    so from time to time i have to write code to send a file or a stream
    back to the end user. in my mini library i have code to do so. however,
    some of the Response object properties arent exactly clear to me, and
    for some reason they arent spec'd out in my v1.1 SDK.

    can anyone provide a simple break down of the intended purpose &
    appropiateness of these:

    Response.Clear()
    Response.ClearHeaders()
    Response.Buffer

    ....thanks!

    matt
     
    matt, Nov 21, 2006
    #1
    1. Advertisements

  2. matt

    Guest Guest

    Guest, Nov 21, 2006
    #2
    1. Advertisements

  3. matt

    matt Guest

    thanks.

    but if MSDN made everything clear, id be expert on everything ive read
    there, and nobody would buy books :)

    while those are useful technical explainations of what each method
    does, i dont know that i would say they clearly spell things out... for
    example, when reading the "HttpResponse.Clear Method" entry, it says:

    Remarks
    The Clear method does not clear header information.

    yet, in the code sample it says:

    // Set the page's content type to JPEG files
    // and clear all response headers.
    Response.ContentType = "image/jpeg";
    Response.Clear();

    ....which seem contradictory to me (does it clear headers, or doesnt it?
    but more importantly -- *why* do i want to clear headers!?)

    so i guess what im looking for is more of a "Well, the basic idea of X
    is xxxx. You really only need to use X when doing Y..." type
    discussion.

    for instance, im going to send the user an .XLS -- why is it important
    to clear the response headers (.ClearHeaders) from my event handler's
    routine? or to use .Clear? omitting the lines seems to make no
    difference in my test environment.

    or, when is it to the developer's advantage to enable output buffering
    on the response?


    ....so can anyone comment on these HttpResponse items in more of a
    non-tech-specs, general-rules-of-thumb fashion?


    thanks!
    matt
     
    matt, Nov 21, 2006
    #3
  4. matt

    Guest Guest

    Yep. I read this as you saying "I think I really need to study the HTTP
    Protocol first". That will help, plenty of free tutorials on the web that
    will explain what headers are, etc.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com
     
    Guest, Nov 22, 2006
    #4
  5. matt

    matt Guest

    well, then i guess i view these groups a little differently. i was
    hoping to initiate a discussion on the topic, not hunt the web for
    articles. so you could say i wrote that saying, "I not an expert on
    HTTP Protocol, and I'm not sure that I want to be. But, can anyone
    offer the general gist of why these commands exist and when they are
    actually necessary?"

    im still interested in that sort of discussion, if any one cares to
    chime in. if not, well then i guess there is a dead thread.


    matt
     
    matt, Nov 22, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.