tags:

views:

345

answers:

1

I am using ionics isapi rewrite filter to redirect all .asp files to validate.asp file to do session validation. But I end up in a loop. Any help would be much appreciated.

my .ini file

ReDirectRule ^/XXXX/(.*).asp?(.*)  /YYYY/validate.asp$2&url1=$1&url2=$2 [R]

validate.asp

<% 
'validation step goes here..

Response.Redirect("../XXXX"&Request.QueryString("url1")&".asp"&Request.QueryString("url2"))
%>
A: 

ini.file

ReWriteRule ^/XXXX/(.+).asp(?:\?(.*))?$ /YYYY/validate.asp?$2&url1=$1&url2=$2 [L]

validate.asp

'validation step goes here..

Server.Transfer("../XXXX"&Request.QueryString("url1") & ".asp")

The Server.Transfer method sends (transfers) all the state information (all application/session variables and all items in the request collections) created in one ASP file to a second ASP file.

Martijn Laarman
fitnet
Martijn Laarman
Thank you again. If you see my comment, after the user logout, if he tries to access the same page by using bookmarked url, isapi filter will ignore it, since it will have redirected=1. can we do the redirect flag in the http headers or if any one has different answer.
fitnet
I updated my answer to a more simplified solution, the key thing being that there shouldn't be any redirecting nor trough IIRF nor trough ASP's Server.Redirect to preserve the original url for bookmarking. Server.Transfers works with local file paths only so IIRF isn't re-triggered over and over.
Martijn Laarman