Search code examples
isapi

Isapi rewrite filter ends up in a loop


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"))
%>

Solution

  • 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.