By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,209 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,209 IT Pros & Developers. It's quick & easy.

HTTP headers and Response.Redirect

P: n/a
Sam
I have some issues with HTTP Headers and I was hoping for
some pointers or references to good articles.

Here is the problem.
I have 6 .aspx pages, each page contains a common .ascx.
This ascx serves two purposes, 1. it contains a tab strip
with response.redirects to navigate to the other pages;
2. I authenticate the user by check to see if a cookie
exists, if it doesn't I redirect to a login screen.

Now recently when the user is redirected I receive error
messages such as "The object was aborted" and "Object
moved to here". From what I have read I am getting these
error messages because I have sent HTTP headers to the
client before I redirect. Apparently response.end raises
an exception, so I added false for the endResponse
property on the response.redirect, but that didn't fix
the problem.

So what actions send HTTP headers? Do any of the
following, which are contained in my pages?
1. Page.DataBind()
2. Context.Response.Cookies("name").Values("val") = ...
3. Page.RegisterClientScriptBlock("...")
4. Session.Item("name") = ...
5. Accessing a web control e.g. txtFirstname.text = "xxx"
(textbox)
6. Third Party server controls. Im using
Coalesys.WebMenu for dropdowns.

Is there a tracing tool to see if headers have been sent?

Any assistance would be greatly appreciated.
Sam

Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi Sam,

The easiest thing to do might be to just call Response.Clear() before you
call Response.Redirect(). I actually thought this happened automatically,
but apparently not...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sam" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
I have some issues with HTTP Headers and I was hoping for
some pointers or references to good articles.

Here is the problem.
I have 6 .aspx pages, each page contains a common .ascx.
This ascx serves two purposes, 1. it contains a tab strip
with response.redirects to navigate to the other pages;
2. I authenticate the user by check to see if a cookie
exists, if it doesn't I redirect to a login screen.

Now recently when the user is redirected I receive error
messages such as "The object was aborted" and "Object
moved to here". From what I have read I am getting these
error messages because I have sent HTTP headers to the
client before I redirect. Apparently response.end raises
an exception, so I added false for the endResponse
property on the response.redirect, but that didn't fix
the problem.

So what actions send HTTP headers? Do any of the
following, which are contained in my pages?
1. Page.DataBind()
2. Context.Response.Cookies("name").Values("val") = ...
3. Page.RegisterClientScriptBlock("...")
4. Session.Item("name") = ...
5. Accessing a web control e.g. txtFirstname.text = "xxx"
(textbox)
6. Third Party server controls. Im using
Coalesys.WebMenu for dropdowns.

Is there a tracing tool to see if headers have been sent?

Any assistance would be greatly appreciated.
Sam

Nov 18 '05 #2

P: n/a
sam
Hi Rick,
I tried that but I still randomly get "Object moved to
here". Will I have to set buffering properties for this
to work. IIS has "Enable Buffering" ticked and each .aspx
page has buffer set to true.

Sam
-----Original Message-----
Hi Sam,

The easiest thing to do might be to just call Response.Clear() before youcall Response.Redirect(). I actually thought this happened automatically,but apparently not...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sam" <an*******@discussions.microsoft.com> wrote in messagenews:00****************************@phx.gbl...
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles.

Here is the problem.
I have 6 .aspx pages, each page contains a common .ascx. This ascx serves two purposes, 1. it contains a tab strip with response.redirects to navigate to the other pages;
2. I authenticate the user by check to see if a cookie
exists, if it doesn't I redirect to a login screen.

Now recently when the user is redirected I receive error messages such as "The object was aborted" and "Object
moved to here". From what I have read I am getting these error messages because I have sent HTTP headers to the
client before I redirect. Apparently response.end raises an exception, so I added false for the endResponse
property on the response.redirect, but that didn't fix
the problem.

So what actions send HTTP headers? Do any of the
following, which are contained in my pages?
1. Page.DataBind()
2. Context.Response.Cookies("name").Values("val") = ...
3. Page.RegisterClientScriptBlock("...")
4. Session.Item("name") = ...
5. Accessing a web control e.g. txtFirstname.text = "xxx" (textbox)
6. Third Party server controls. Im using
Coalesys.WebMenu for dropdowns.

Is there a tracing tool to see if headers have been sent?
Any assistance would be greatly appreciated.
Sam

.

Nov 18 '05 #3

P: n/a
> So what actions send HTTP headers? Do any of the
following, which are contained in my pages?
Setting Cookies.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Sam" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl... I have some issues with HTTP Headers and I was hoping for
some pointers or references to good articles.

Here is the problem.
I have 6 .aspx pages, each page contains a common .ascx.
This ascx serves two purposes, 1. it contains a tab strip
with response.redirects to navigate to the other pages;
2. I authenticate the user by check to see if a cookie
exists, if it doesn't I redirect to a login screen.

Now recently when the user is redirected I receive error
messages such as "The object was aborted" and "Object
moved to here". From what I have read I am getting these
error messages because I have sent HTTP headers to the
client before I redirect. Apparently response.end raises
an exception, so I added false for the endResponse
property on the response.redirect, but that didn't fix
the problem.

So what actions send HTTP headers? Do any of the
following, which are contained in my pages?
1. Page.DataBind()
2. Context.Response.Cookies("name").Values("val") = ...
3. Page.RegisterClientScriptBlock("...")
4. Session.Item("name") = ...
5. Accessing a web control e.g. txtFirstname.text = "xxx"
(textbox)
6. Third Party server controls. Im using
Coalesys.WebMenu for dropdowns.

Is there a tracing tool to see if headers have been sent?

Any assistance would be greatly appreciated.
Sam

Nov 18 '05 #4

P: n/a
Hi Sam,

I've seen this with other tools and it usually happens when additional
output is sent after the Redirect(). At that point you get very weird
behavior in browsers where sometimes requests redirect as you want them to
and others where the partial page is displayed etc.

Have you tried forcing an explicit Response.End() after the redirect? Again
I'm pretty sure that this is automatically implied by ASP.Net, but it can't
hurt.

Finally the Moved is actually the content message of the redirect page. So
in a way it seems to me that ASP.Net is serving the data correctly, but IE
might misinterpreting it.

One thing that I can think of is a bug in IE that has to do with content
types and headers being cached. For example, if you generate a page that
returns binary content (like a zip file) but can also generate a text
message on an error - if you have an error first and then send the Zip file
IE will try to display the zip file as text because it cahced the content
type header. Maybe something similar is happening here. You might want to
try another browser or check HTTP Headers.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"sam" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
Hi Rick,
I tried that but I still randomly get "Object moved to
here". Will I have to set buffering properties for this
to work. IIS has "Enable Buffering" ticked and each .aspx
page has buffer set to true.

Sam
-----Original Message-----
Hi Sam,

The easiest thing to do might be to just call

Response.Clear() before you
call Response.Redirect(). I actually thought this

happened automatically,
but apparently not...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sam" <an*******@discussions.microsoft.com> wrote in

message
news:00****************************@phx.gbl...
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles.

Here is the problem.
I have 6 .aspx pages, each page contains a common .ascx. This ascx serves two purposes, 1. it contains a tab strip with response.redirects to navigate to the other pages;
2. I authenticate the user by check to see if a cookie
exists, if it doesn't I redirect to a login screen.

Now recently when the user is redirected I receive error messages such as "The object was aborted" and "Object
moved to here". From what I have read I am getting these error messages because I have sent HTTP headers to the
client before I redirect. Apparently response.end raises an exception, so I added false for the endResponse
property on the response.redirect, but that didn't fix
the problem.

So what actions send HTTP headers? Do any of the
following, which are contained in my pages?
1. Page.DataBind()
2. Context.Response.Cookies("name").Values("val") = ...
3. Page.RegisterClientScriptBlock("...")
4. Session.Item("name") = ...
5. Accessing a web control e.g. txtFirstname.text = "xxx" (textbox)
6. Third Party server controls. Im using
Coalesys.WebMenu for dropdowns.

Is there a tracing tool to see if headers have been sent?
Any assistance would be greatly appreciated.
Sam

.

Nov 18 '05 #5

P: n/a
sam
Thanks for your advise Rick.
In some situations I am sending content after the
response.redirect. And also I think cookies maybe
upsetting things. I'll refactor and see if it improves.

Thanks again,
Sam
-----Original Message-----
Hi Sam,

I've seen this with other tools and it usually happens when additionaloutput is sent after the Redirect(). At that point you get very weirdbehavior in browsers where sometimes requests redirect as you want them toand others where the partial page is displayed etc.

Have you tried forcing an explicit Response.End() after the redirect? AgainI'm pretty sure that this is automatically implied by ASP.Net, but it can'thurt.

Finally the Moved is actually the content message of the redirect page. Soin a way it seems to me that ASP.Net is serving the data correctly, but IEmight misinterpreting it.

One thing that I can think of is a bug in IE that has to do with contenttypes and headers being cached. For example, if you generate a page thatreturns binary content (like a zip file) but can also generate a textmessage on an error - if you have an error first and then send the Zip fileIE will try to display the zip file as text because it cahced the contenttype header. Maybe something similar is happening here. You might want totry another browser or check HTTP Headers.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"sam" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl...
Hi Rick,
I tried that but I still randomly get "Object moved to
here". Will I have to set buffering properties for this
to work. IIS has "Enable Buffering" ticked and each .aspx page has buffer set to true.

Sam
>-----Original Message-----
>Hi Sam,
>
>The easiest thing to do might be to just call

Response.Clear() before you
>call Response.Redirect(). I actually thought this

happened automatically,
>but apparently not...
>
>+++ Rick ---
>
>--
>
>Rick Strahl
>West Wind Technologies
>http://www.west-wind.com/
>http://www.west-wind.com/wwHelp
>----------------------------------
>Making waves on the Web
>
>
>"Sam" <an*******@discussions.microsoft.com> wrote in

message
>news:00****************************@phx.gbl...
>> I have some issues with HTTP Headers and I was hoping
for
>> some pointers or references to good articles.
>>
>> Here is the problem.
>> I have 6 .aspx pages, each page contains a

common .ascx.
>> This ascx serves two purposes, 1. it contains a tab

strip
>> with response.redirects to navigate to the other

pages; >> 2. I authenticate the user by check to see if a cookie >> exists, if it doesn't I redirect to a login screen.
>>
>> Now recently when the user is redirected I receive

error
>> messages such as "The object was aborted" and "Object >> moved to here". From what I have read I am getting

these
>> error messages because I have sent HTTP headers to the >> client before I redirect. Apparently response.end

raises
>> an exception, so I added false for the endResponse
>> property on the response.redirect, but that didn't fix >> the problem.
>>
>> So what actions send HTTP headers? Do any of the
>> following, which are contained in my pages?
>> 1. Page.DataBind()
>> 2. Context.Response.Cookies("name").Values("val") = ... >> 3. Page.RegisterClientScriptBlock("...")
>> 4. Session.Item("name") = ...
>> 5. Accessing a web control e.g. txtFirstname.text

= "xxx"
>> (textbox)
>> 6. Third Party server controls. Im using
>> Coalesys.WebMenu for dropdowns.
>>
>> Is there a tracing tool to see if headers have been

sent?
>>
>> Any assistance would be greatly appreciated.
>> Sam
>>
>
>
>.
>

.

Nov 18 '05 #6

P: n/a
Remember one thing: Redirects don't send any headers, so if you are setting
cookies (or use a Session object for the first time) the redirect will loose
the cookie/session/header since it's not being sent.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"sam" <an*******@discussions.microsoft.com> wrote in message
news:e6****************************@phx.gbl...
Thanks for your advise Rick.
In some situations I am sending content after the
response.redirect. And also I think cookies maybe
upsetting things. I'll refactor and see if it improves.

Thanks again,
Sam
-----Original Message-----
Hi Sam,

I've seen this with other tools and it usually happens

when additional
output is sent after the Redirect(). At that point you

get very weird
behavior in browsers where sometimes requests redirect

as you want them to
and others where the partial page is displayed etc.

Have you tried forcing an explicit Response.End() after

the redirect? Again
I'm pretty sure that this is automatically implied by

ASP.Net, but it can't
hurt.

Finally the Moved is actually the content message of the

redirect page. So
in a way it seems to me that ASP.Net is serving the data

correctly, but IE
might misinterpreting it.

One thing that I can think of is a bug in IE that has to

do with content
types and headers being cached. For example, if you

generate a page that
returns binary content (like a zip file) but can also

generate a text
message on an error - if you have an error first and

then send the Zip file
IE will try to display the zip file as text because it

cahced the content
type header. Maybe something similar is happening here.

You might want to
try another browser or check HTTP Headers.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"sam" <an*******@discussions.microsoft.com> wrote in

message
news:06****************************@phx.gbl...
Hi Rick,
I tried that but I still randomly get "Object moved to
here". Will I have to set buffering properties for this
to work. IIS has "Enable Buffering" ticked and each .aspx page has buffer set to true.

Sam

>-----Original Message-----
>Hi Sam,
>
>The easiest thing to do might be to just call
Response.Clear() before you
>call Response.Redirect(). I actually thought this
happened automatically,
>but apparently not...
>
>+++ Rick ---
>
>--
>
>Rick Strahl
>West Wind Technologies
>http://www.west-wind.com/
>http://www.west-wind.com/wwHelp
>----------------------------------
>Making waves on the Web
>
>
>"Sam" <an*******@discussions.microsoft.com> wrote in
message
>news:00****************************@phx.gbl...
>> I have some issues with HTTP Headers and I was hoping for
>> some pointers or references to good articles.
>>
>> Here is the problem.
>> I have 6 .aspx pages, each page contains a
common .ascx.
>> This ascx serves two purposes, 1. it contains a tab
strip
>> with response.redirects to navigate to the other pages; >> 2. I authenticate the user by check to see if a cookie >> exists, if it doesn't I redirect to a login screen.
>>
>> Now recently when the user is redirected I receive
error
>> messages such as "The object was aborted" and "Object >> moved to here". From what I have read I am getting
these
>> error messages because I have sent HTTP headers to the >> client before I redirect. Apparently response.end
raises
>> an exception, so I added false for the endResponse
>> property on the response.redirect, but that didn't fix >> the problem.
>>
>> So what actions send HTTP headers? Do any of the
>> following, which are contained in my pages?
>> 1. Page.DataBind()
>> 2. Context.Response.Cookies("name").Values("val") = ... >> 3. Page.RegisterClientScriptBlock("...")
>> 4. Session.Item("name") = ...
>> 5. Accessing a web control e.g. txtFirstname.text
= "xxx"
>> (textbox)
>> 6. Third Party server controls. Im using
>> Coalesys.WebMenu for dropdowns.
>>
>> Is there a tracing tool to see if headers have been
sent?
>>
>> Any assistance would be greatly appreciated.
>> Sam
>>
>
>
>.
>

.

Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.