473,417 Members | 1,530 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,417 software developers and data experts.

How to know if a redirect has been done?

Hi,

I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest.
This code calls a sub and I need to know if that sub did a response redirect
or not.

Specifically I need to know that either the sub did a redirect or a specific
value
was specified in the URL. If neither a redirect was done and a certain value
was
not specified in the URL then I need to throw an error. Check for the query
string value is easy but how do I know if a redirect was done?

Any help much appreciated.
Regards,
Peter Row
Nov 18 '05 #1
6 6881
Cant you just add a param to the querystring indicating that it was part of
a redirect request ie. redirected=true. Your checking the querystring
anyway

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Hi,

I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest.
This code calls a sub and I need to know if that sub did a response redirect or not.

Specifically I need to know that either the sub did a redirect or a specific value
was specified in the URL. If neither a redirect was done and a certain value was
not specified in the URL then I need to throw an error. Check for the query string value is easy but how do I know if a redirect was done?

Any help much appreciated.
Regards,
Peter Row

Nov 18 '05 #2
Hi,

No I can't because the redirect is made and then the code that runs after
the .Redirect line
needs to know if a redirect statement has been made.

Therefore if the actual redirect has not actually taken place yet it's
params won't be available.

Anybody else have any thoughts?

Regards,
Peter Row
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Cant you just add a param to the querystring indicating that it was part of a redirect request ie. redirected=true. Your checking the querystring
anyway

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Hi,

I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response

redirect
or not.

Specifically I need to know that either the sub did a redirect or a

specific
value
was specified in the URL. If neither a redirect was done and a certain

value
was
not specified in the URL then I need to throw an error. Check for the

query
string value is easy but how do I know if a redirect was done?

Any help much appreciated.
Regards,
Peter Row


Nov 18 '05 #3
you could always put somthing in the session to say a redirect occured....

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:#C**************@TK2MSFTNGP11.phx.gbl...
Hi,

No I can't because the redirect is made and then the code that runs after
the .Redirect line
needs to know if a redirect statement has been made.

Therefore if the actual redirect has not actually taken place yet it's
params won't be available.

Anybody else have any thoughts?

Regards,
Peter Row
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Cant you just add a param to the querystring indicating that it was part

of
a redirect request ie. redirected=true. Your checking the querystring
anyway

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Hi,

I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response

redirect
or not.

Specifically I need to know that either the sub did a redirect or a

specific
value
was specified in the URL. If neither a redirect was done and a certain

value
was
not specified in the URL then I need to throw an error. Check for the

query
string value is easy but how do I know if a redirect was done?

Any help much appreciated.
Regards,
Peter Row



Nov 18 '05 #4
Hi,

Hmmm.... not a bad thought, however in my app sessions are disabled.
Isn't there some ASP object with some property or something available that
tells you if a redirect is immanent?

Regards,
Peter Row
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:uT****************@TK2MSFTNGP11.phx.gbl...
you could always put somthing in the session to say a redirect occured....

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:#C**************@TK2MSFTNGP11.phx.gbl...
Hi,

No I can't because the redirect is made and then the code that runs after the .Redirect line
needs to know if a redirect statement has been made.

Therefore if the actual redirect has not actually taken place yet it's
params won't be available.

Anybody else have any thoughts?

Regards,
Peter Row
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
Cant you just add a param to the querystring indicating that it was part
of
a redirect request ie. redirected=true. Your checking the querystring
anyway

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
> Hi,
>
> I am writing a DLL in VB.NET that implements

IHttpHandler.ProcessRequest.
> This code calls a sub and I need to know if that sub did a response
redirect
> or not.
>
> Specifically I need to know that either the sub did a redirect or a
specific
> value
> was specified in the URL. If neither a redirect was done and a

certain value
> was
> not specified in the URL then I need to throw an error. Check for the query
> string value is easy but how do I know if a redirect was done?
>
> Any help much appreciated.
> Regards,
> Peter Row
>
>



Nov 18 '05 #5
A redirect is really nothing but an instruction to the browser to change its
address location and request a different page, hence the suggestion to add
something to the URL the client is about to redirect too as a means of
identifying that the redirect occured and re-entered the ISAPI pipeline. So
you could detect it on the way back in and then throw your error.

However, if your working in the ISAPI Pipeline via handlers anyway, you
might want to take a look at the HttpWorkerRequest.EndOfSendNotification
delegate, this occurs when a response is complete - in theory if you issue a
response.redirect and a response.end then this should action as your
response terminates and you may be able to add a means of detecting your
redirection via this.

http://authors.aspalliance.com/aspxt...uestendofsendn
otificationclass.aspx

Never tried it mind you.....

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:eL**************@tk2msftngp13.phx.gbl...
Hi,

Hmmm.... not a bad thought, however in my app sessions are disabled.
Isn't there some ASP object with some property or something available that
tells you if a redirect is immanent?

Regards,
Peter Row
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:uT****************@TK2MSFTNGP11.phx.gbl...
you could always put somthing in the session to say a redirect occured....

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:#C**************@TK2MSFTNGP11.phx.gbl...
Hi,

No I can't because the redirect is made and then the code that runs

after the .Redirect line
needs to know if a redirect statement has been made.

Therefore if the actual redirect has not actually taken place yet it's
params won't be available.

Anybody else have any thoughts?

Regards,
Peter Row
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
> Cant you just add a param to the querystring indicating that it was part of
> a redirect request ie. redirected=true. Your checking the querystring > anyway
>
> --
> Regards
>
> John Timney (Microsoft ASP.NET MVP)
> ----------------------------------------------
> <shameless_author_plug>
> Professional .NET for Java Developers with C#
> ISBN:1-861007-91-4
> Professional Windows Forms
> ISBN: 1861005547
> Professional JSP 2nd Edition
> ISBN: 1861004958
> Professional JSP
> ISBN: 1861003625
> Beginning JSP Web Development
> ISBN: 1861002092
> </shameless_author_plug>
> ----------------------------------------------
>
> "Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
> news:Oe**************@tk2msftngp13.phx.gbl...
> > Hi,
> >
> > I am writing a DLL in VB.NET that implements
IHttpHandler.ProcessRequest.
> > This code calls a sub and I need to know if that sub did a response > redirect
> > or not.
> >
> > Specifically I need to know that either the sub did a redirect or a > specific
> > value
> > was specified in the URL. If neither a redirect was done and a certain > value
> > was
> > not specified in the URL then I need to throw an error. Check for the > query
> > string value is easy but how do I know if a redirect was done?
> >
> > Any help much appreciated.
> > Regards,
> > Peter Row
> >
> >
>
>



Nov 18 '05 #6
Hi,

In my case it is the later. I issue a redirect but before that gets sent to
the users browser for them to request; the rest of the response
completes first. And it is here I need to know if a redirect has been issued
which at the end of the response will be sent to the users
browser and hence cause another request.

However I have been having a bit of a brain guff!
I have an Asp wrapper class which has a RedirectSafely() method to get
around the phaff needed to stop ThreadAbortedExceptions
from occuring. Therefore since I always call this instead of
Response.Redirect directly all I need to do is set a private member
variable flag to indicate it has been called. My implementation of
IHttpHandler.ProcessRequest can then check this and raise the
appropriate error when RedirectNotDone AndAlso QueryString("XXX") = ""

Thanks for taking time to think it over any way.
Regards,
Peter Row

"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:eg**************@TK2MSFTNGP10.phx.gbl...
A redirect is really nothing but an instruction to the browser to change its address location and request a different page, hence the suggestion to add
something to the URL the client is about to redirect too as a means of
identifying that the redirect occured and re-entered the ISAPI pipeline. So you could detect it on the way back in and then throw your error.

However, if your working in the ISAPI Pipeline via handlers anyway, you
might want to take a look at the HttpWorkerRequest.EndOfSendNotification
delegate, this occurs when a response is complete - in theory if you issue a response.redirect and a response.end then this should action as your
response terminates and you may be able to add a means of detecting your
redirection via this.

http://authors.aspalliance.com/aspxt...uestendofsendn otificationclass.aspx

Never tried it mind you.....

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:eL**************@tk2msftngp13.phx.gbl...
Hi,

Hmmm.... not a bad thought, however in my app sessions are disabled.
Isn't there some ASP object with some property or something available that
tells you if a redirect is immanent?

Regards,
Peter Row
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:uT****************@TK2MSFTNGP11.phx.gbl...
you could always put somthing in the session to say a redirect occured....
--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:#C**************@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> No I can't because the redirect is made and then the code that runs after
> the .Redirect line
> needs to know if a redirect statement has been made.
>
> Therefore if the actual redirect has not actually taken place yet it's > params won't be available.
>
> Anybody else have any thoughts?
>
> Regards,
> Peter Row
> "John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message > news:eF**************@TK2MSFTNGP10.phx.gbl...
> > Cant you just add a param to the querystring indicating that it
was part
> of
> > a redirect request ie. redirected=true. Your checking the querystring > > anyway
> >
> > --
> > Regards
> >
> > John Timney (Microsoft ASP.NET MVP)
> > ----------------------------------------------
> > <shameless_author_plug>
> > Professional .NET for Java Developers with C#
> > ISBN:1-861007-91-4
> > Professional Windows Forms
> > ISBN: 1861005547
> > Professional JSP 2nd Edition
> > ISBN: 1861004958
> > Professional JSP
> > ISBN: 1861003625
> > Beginning JSP Web Development
> > ISBN: 1861002092
> > </shameless_author_plug>
> > ----------------------------------------------
> >
> > "Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
> > news:Oe**************@tk2msftngp13.phx.gbl...
> > > Hi,
> > >
> > > I am writing a DLL in VB.NET that implements
> IHttpHandler.ProcessRequest.
> > > This code calls a sub and I need to know if that sub did a response > > redirect
> > > or not.
> > >
> > > Specifically I need to know that either the sub did a redirect
or a > > specific
> > > value
> > > was specified in the URL. If neither a redirect was done and a

certain
> > value
> > > was
> > > not specified in the URL then I need to throw an error. Check

for the
> > query
> > > string value is easy but how do I know if a redirect was done?
> > >
> > > Any help much appreciated.
> > > Regards,
> > > Peter Row
> > >
> > >
> >
> >
>
>



Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Python Baby | last post by:
I'm about to try a little test project in Python, but want to make sure I'm on the right foot. Any advice appreciated before I start this. MOST important : I want to make sure I'm not just...
1
by: moon | last post by:
Wondering if this is possible? Situation: I have a frameset with a few frames in it that loads side graphics, main navigation, subnavigation and content. Everything works fine. Now, I decided...
1
by: muskan | last post by:
Does any body has been done Advamce C++ from ACC Austin?
1
by: Peter Kirk | last post by:
Hi there I have a program written by another company (it's a "web control" which returns a web-page: can I compare this to a servlet in the Java world?), which they think is causing problems on...
4
by: bnob | last post by:
In a Button clik event I have this code at the end of the event Response.Redirect("Page.aspx") But in this event I must show a message before redirect to the Page.aspx. I use to show Message...
2
by: AAOMTim | last post by:
Depending on user permissions, I would like to be able to change a redirect to disallow certain users from going to a bookmarked page for which they should have no access. Is there a way to modify...
3
by: Thomas | last post by:
Hi All, i am getting this error once i submit my page to a payment gateway and when it returns the reponse back. Redirect URI cannot contain newline characters. Description: An unhandled...
2
by: lm247 | last post by:
Hi, I have the following script which processes the html form and inserts into 3 tables. How can I pass the value of the variable EDSID to the next page using response.redirect? Been trying to...
30
Niheel
by: Niheel | last post by:
http://bytes.com/images/howtos/freelance_millions.jpgAccording to India Times, there are groups of freelancers in India making over a millions dollars by providing development and IT services to...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.