Response.header and response.contentType

Discussion in 'ASP General' started by Katie, Aug 17, 2006.

  1. Katie

    Katie Guest

    Hi,

    I am trying to set the content type and header for the response object
    but for some reason it doesnt set it. I tried it on dev and it worked
    fine but didnot on production. The difference is that dev is http and
    production is https. Is there any difference in setting the header and
    content type when doing so a http and when on a https server.

    Thanks for your help
    :)
    Katie, Aug 17, 2006
    #1
    1. Advertising

  2. Katie

    Bobbo Guest

    Katie wrote:

    > [stuff about HTTP headers and SSL]


    I can't advise about this specific situation, but a great tool for
    debugging stuff like this is Firefox with the Live HTTP Headers
    extension installed.

    http://livehttpheaders.mozdev.org/

    Simply hit Alt+L and you'll get a sidebar that pops out. Then browse
    the page that's causing trouble and you'll see all the request/response
    activity.
    Bobbo, Aug 17, 2006
    #2
    1. Advertising

  3. "Katie" <> wrote in message
    news:...
    > Hi,
    >
    > I am trying to set the content type and header for the response object
    > but for some reason it doesnt set it.


    How did you discover that it doesn't set it?

    >I tried it on dev and it worked
    > fine but didnot on production. The difference is that dev is http and
    > production is https. Is there any difference in setting the header and
    > content type when doing so a http and when on a https server.


    There is no difference. https isn't really a different protocol it is http
    over ssl where ssl is at a lower level than http. The http contents
    including headers remain intact when sent over ssl.

    I take it by Response.Header you meant Response.AddHeader?

    >
    > Thanks for your help
    > :)
    >
    Anthony Jones, Aug 17, 2006
    #3
  4. Katie

    Katie Guest

    Yes it is response.addHeader i am trying to use

    the code is

    Response.AddHeader "content-disposition",
    "attachment;filename="&originalFileName
    Response.ContentType = contentType

    the variable contentType and originalFileName are set to the correct
    values, i verified that by printing them out. For some reason it takes
    the content type as html no matter what and it gives some random text
    for the filename

    thanks
    :)
    Katie wrote:
    > Hi,
    >
    > I am trying to set the content type and header for the response object
    > but for some reason it doesnt set it. I tried it on dev and it worked
    > fine but didnot on production. The difference is that dev is http and
    > production is https. Is there any difference in setting the header and
    > content type when doing so a http and when on a https server.
    >
    > Thanks for your help
    > :)
    Katie, Aug 17, 2006
    #4
  5. "Katie" <> wrote in message
    news:...
    > Yes it is response.addHeader i am trying to use
    >
    > the code is
    >
    > Response.AddHeader "content-disposition",
    > "attachment;filename="&originalFileName
    > Response.ContentType = contentType
    >
    > the variable contentType and originalFileName are set to the correct
    > values, i verified that by printing them out. For some reason it takes
    > the content type as html no matter what and it gives some random text
    > for the filename
    >


    Printed out from where, how?

    What I'm not yet convinced off is how you are seeing the headers aren't what
    they should be at the client end?

    Is Response.Buffer true or false?


    > thanks
    > :)
    > Katie wrote:
    > > Hi,
    > >
    > > I am trying to set the content type and header for the response object
    > > but for some reason it doesnt set it. I tried it on dev and it worked
    > > fine but didnot on production. The difference is that dev is http and
    > > production is https. Is there any difference in setting the header and
    > > content type when doing so a http and when on a https server.
    > >
    > > Thanks for your help
    > > :)

    >
    Anthony Jones, Aug 17, 2006
    #5
  6. Katie

    Bobbo Guest

    Katie wrote:

    > For some reason it takes
    > the content type as html no matter what and it gives some random text
    > for the filename


    Can you show us these values please?
    Bobbo, Aug 17, 2006
    #6
  7. Katie

    Katie Guest

    I am passing the content type and the originalfilename in the query
    string to the page along with other info. It seems like it is taking
    the entire querystring as teh filename and not using the
    response.contentType = original filename

    also response.clear doesnot seem to be working
    are there any settings for response headers which may prevent pages
    from modifying it>?

    thanks
    :)
    Anthony Jones wrote:
    > "Katie" <> wrote in message
    > news:...
    > > Yes it is response.addHeader i am trying to use
    > >
    > > the code is
    > >
    > > Response.AddHeader "content-disposition",
    > > "attachment;filename="&originalFileName
    > > Response.ContentType = contentType
    > >
    > > the variable contentType and originalFileName are set to the correct
    > > values, i verified that by printing them out. For some reason it takes
    > > the content type as html no matter what and it gives some random text
    > > for the filename
    > >

    >
    > Printed out from where, how?
    >
    > What I'm not yet convinced off is how you are seeing the headers aren't what
    > they should be at the client end?
    >
    > Is Response.Buffer true or false?
    >
    >
    > > thanks
    > > :)
    > > Katie wrote:
    > > > Hi,
    > > >
    > > > I am trying to set the content type and header for the response object
    > > > but for some reason it doesnt set it. I tried it on dev and it worked
    > > > fine but didnot on production. The difference is that dev is http and
    > > > production is https. Is there any difference in setting the header and
    > > > content type when doing so a http and when on a https server.
    > > >
    > > > Thanks for your help
    > > > :)

    > >
    Katie, Aug 17, 2006
    #7
  8. Katie wrote:
    > I am passing the content type and the originalfilename in
    > the query string to the page along with other info. It seems
    > like it is taking the entire querystring as teh filename and
    > not using the response.contentType = original filename
    >
    > also response.clear doesnot seem to be working
    > are there any settings for response headers which may prevent
    > pages from modifying it>?


    [blink]. Are you *absolutely* certain that Response.Clear() is not clearing
    the header you set? You still have not shown any code, BTW.



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.
    Dave Anderson, Aug 17, 2006
    #8
  9. "Katie" <> wrote in message
    news:...
    > I am passing the content type and the originalfilename in the query
    > string to the page along with other info. It seems like it is taking
    > the entire querystring as teh filename and not using the
    > response.contentType = original filename
    >
    > also response.clear doesnot seem to be working
    > are there any settings for response headers which may prevent pages
    > from modifying it>?
    >


    I agree with Dave, I'm still struggling to imagine what you are actually
    doing. A little bit of code would really help right now.


    > thanks
    > :)
    > Anthony Jones wrote:
    > > "Katie" <> wrote in message
    > > news:...
    > > > Yes it is response.addHeader i am trying to use
    > > >
    > > > the code is
    > > >
    > > > Response.AddHeader "content-disposition",
    > > > "attachment;filename="&originalFileName
    > > > Response.ContentType = contentType
    > > >
    > > > the variable contentType and originalFileName are set to the correct
    > > > values, i verified that by printing them out. For some reason it takes
    > > > the content type as html no matter what and it gives some random text
    > > > for the filename
    > > >

    > >
    > > Printed out from where, how?
    > >
    > > What I'm not yet convinced off is how you are seeing the headers aren't

    what
    > > they should be at the client end?
    > >
    > > Is Response.Buffer true or false?
    > >
    > >
    > > > thanks
    > > > :)
    > > > Katie wrote:
    > > > > Hi,
    > > > >
    > > > > I am trying to set the content type and header for the response

    object
    > > > > but for some reason it doesnt set it. I tried it on dev and it

    worked
    > > > > fine but didnot on production. The difference is that dev is http

    and
    > > > > production is https. Is there any difference in setting the header

    and
    > > > > content type when doing so a http and when on a https server.
    > > > >
    > > > > Thanks for your help
    > > > > :)
    > > >

    >
    Anthony Jones, Aug 17, 2006
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alien2_51

    Response.ContentType

    alien2_51, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    742
    alien2_51
    Jun 26, 2003
  2. Bart Vanwesemael
    Replies:
    1
    Views:
    514
    William F. Robertson, Jr.
    Jul 28, 2003
  3. TJS
    Replies:
    5
    Views:
    1,035
    Alvin Bruney
    Nov 19, 2003
  4. =?Utf-8?B?RXlhbCBaaW5kZXI=?=

    Response.ContentType and Viewstate problem

    =?Utf-8?B?RXlhbCBaaW5kZXI=?=, Apr 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    445
    =?Utf-8?B?RXlhbCBaaW5kZXI=?=
    Apr 22, 2004
  5. David Lozzi
    Replies:
    5
    Views:
    12,409
    Matt Berther
    Jan 14, 2005
Loading...

Share This Page