473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HTTP headers and Response.Redirect

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
6 4287
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
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
> 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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Phillip N Rounds | last post by:
I have a webform, from which I have to submit info to another site. Their instructions are to have a html form, with the following as the submit: <form method="post"...
5
by: Shelly | last post by:
hi, I am trying to create a custom HTTP header and trying to access that variable on another ASP.NET webpage. Following is the code base- I use the following code to set the header...
1
by: chsakda | last post by:
In my Page_Load Method, I call a method by asynchronous callback to do some work. It's working fine until it calls back. Here is the problem in my callback method. Basically, I cannot redirect...
0
by: Hai Nguyen | last post by:
Hi everyone I have a progressive bar which is outputted by Response.Write("javascript code") and Response.Flush() After the progressive bar reach 100% I want to redirect this page to my main...
8
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
6
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
4
by: Purushottam Khandebharad | last post by:
Hi all, I need to pass HTTP Headers from onw web site to another web site as I need to post a form on one web applications page to page on different web site both sites are under my control,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.