Jump to content

Content-type Header


justsomeguy
 Share

Recommended Posts

I'm using this to set the content-type in an ASP classic page:Response.AddHeader("Content-Type", "text/plain; charset=utf-8");When I view the request and response in Firebug, the response headers indicate a content type of text/html and don't show the charset. Is there a trick to setting charset in ASP classic?

Link to comment
Share on other sites

  • 4 months later...

The manual page on MSDN about AddHeader() says that it doesn't replace existing headers. Near that same documentation, there is Response.ContentType(), which should replace the default text/html. I'm guessing that you can specify the charset parameter within the header's value. If that doesn't work, there's also the Response.Charset() method, which should do exactly what you want. You should also set the CodePage, just in case.Offtopic://Isn't it funny that you - a person known around here with his PHP expertise - has to deal with ASP (and classic for that matter! Yuck! :) ), and even funnier that me - a person who has never wrote a single line of ASP code in his life - is the one to answer your question? :)

Edited by boen_robot
Link to comment
Share on other sites

Offtopic://Isn't it funny that you - a person known around here with his PHP expertise - has to deal with ASP (and classic for that matter! Yuck! )
Don't even get me started. This was for a major international corporate client who has a policy not to install open-source software on their servers. Work for them always takes twice as long. It took 5-6 hours for their DBA to set me up with a database table with 5 columns in it.Even so, ASP classic was the first scripting language I learned, I thought it was pretty useful until I learned PHP. Unfortunately all of the server-side code at the place I work was ASP/VBscript when I got here. I started working with Jscript instead until I could convince people to move to PHP.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...