Clearing Default HTTP Headers and Writing RAW HTTP Content

Clearing Default HTTP Headers and Writing RAW HTTP Content

Hi all,
Normally when an ASP.NET Page is executed, it creates some of default HTTP Headers.
As it is shown below for example:

Headers
{
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Sat, 02 Jul 2005 06:31:53 GMT
X-Powered-By: ASP.NET
Connection: close
X-AspNet-Version: 2.0.40607
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 1024
}

This is an example of HTTP Headers of an executed ASP.NET Page Response.
I want to know is there any way to clear all of these headers; and put my own custom HTTP Headers instead of them ?
I know it's possible to Add or Append a Custom Header to Current Page's HTTP Headers with these methods:

Response.AddHeader
Response.AppendHeader

And I also know that the Response.ClearHeaders method is designed to CLEAR the output HTTP Headers, but it Doesn't Work :((

All that I want is to Clear the Default HTTP Headers and Write My Own headers instead of them.
Is it possible at all ?

Thanks for reply from anyone.
crowisgodAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cupawntaeCommented:
Unfortunately that method only clears application-added headers. Try adding some custom headers, then calling it - the custom headers will be gone.

So unfortunately looks like you can't do what you're trying to do in ASP.NET :-(

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jesse HouwingScrum Trainer | Microsoft MVP | ALM Ranger | ConsultantCommented:
A number of these headers are not added by ASP.net, but by IIS...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.