Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x support forum
 Helicon Tech : ISAPI_Rewrite 2.x support forum
Subject Topic: Obtaining the Requested Url Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Spec_David
Newbie
Newbie


Joined: 25 June 2008
Online Status: Offline
Posts: 11
Posted: 25 June 2008 at 12:13pm | IP Logged Quote Spec_David

On one of our recent projects we used ISAPI Rewrite on our web server to rewrite Wildcard domains. We got our rewrite rules working with the help of these support forums (thanks for that), but now we would like to track the original url. We have attempted to use the asp native functionality with the "Server" associative array. Here is a snippet of our code:

**********************

<input type="hidden" name="RequestUrl" id="RequestUrl" value="<%# Request.ServerVariables["HTTP_X_REWRITE_URL"] %>" />

**********************
 
This is our hidden field which stores the original requested url, however, it does not seem to do this. Instead, it stores the current url as if it was passing through 2 filters and storing the requested url after it was passed through the first filter. There is however, only one global set filter on our web server (and that is the ISAPI Rewrite.dll). If it will help any, I have included the rewrite rules also, they work perfectly:

**********************

# new condition
RewriteCond Host: .*(ionagradpro)\.com
RewriteRule (.*) http\://www.ondemandcollateral.net/IONA/index.aspx?id=1 [I,RP]

**********************

Any help you can offer would be of great appreciation.

Oh and PS: We've tried the 'U' post-operator to unmangle the log, but it is undocumented as to where this log is and upon trying this, the "log" does not refer to the address bar where the url is located.
Back to Top View Spec_David's Profile Search for other posts by Spec_David Visit Spec_David's Homepage
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7460
Posted: 30 June 2008 at 4:33pm | IP Logged Quote Lexey

Since you have a redirect here a client performs a second request with a new URI. And this URI will be written to the X-Rewrite-URL. There is no information about an old URI in the 2nd request. If you need it you will have to pass it to a new URI explicitly. For example, in a query string parameter.
Back to Top View Lexey's Profile Search for other posts by Lexey
 
Spec_David
Newbie
Newbie


Joined: 25 June 2008
Online Status: Offline
Posts: 11
Posted: 01 July 2008 at 10:19am | IP Logged Quote Spec_David

Gotcha, without the 'RP' tag, it no longer functions correctly. So I must use a query string parameter. However, looking at the rewrite rule above with a small modification:

*********
# new condition
RewriteCond Host: .*(ionagradpro)\.com
RewriteRule (.*) http\://www.ondemandcollateral.net/IONA/index.aspx?id=1request=$1 [I,RP]
*********

a hit comes in like:

*********
frank.ionagradpro.com
*********

and it redirects to:

*********
http://www.ondemandcollateral.net/IONA/index.aspx?id=1request=ionagradpro
*********

It still appears to be working correctly, but the request url is simply the domain (as there is no folder extension). However, is there anyway to retreive the wildcard portion prior to the actually domain?
Back to Top View Spec_David's Profile Search for other posts by Spec_David Visit Spec_David's Homepage
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7460
Posted: 01 July 2008 at 4:20pm | IP Logged Quote Lexey

And what would you like to get as a rewriting result for that request?
Back to Top View Lexey's Profile Search for other posts by Lexey
 
Spec_David
Newbie
Newbie


Joined: 25 June 2008
Online Status: Offline
Posts: 11
Posted: 02 July 2008 at 10:15am | IP Logged Quote Spec_David

Preferably something along the lines of:

*********
http://www.ondemandcollateral.net/IONA/index.aspx?id=1request=frank.ionagradpro.com
*********

If its possible, would be amazing :D I just really need the wildcard portion more then anything. So even this would suffice:

*********
http://www.ondemandcollateral.net/IONA/index.aspx?id=1request=frank
*********

In dealing with wildcards, I half felt it would be an issue, but if you can make this work, I'd be extremely grateful!
Back to Top View Spec_David's Profile Search for other posts by Spec_David Visit Spec_David's Homepage
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7460
Posted: 03 July 2008 at 6:06pm | IP Logged Quote Lexey

RewriteCond Host: (.*\.ionagradpro\.com)
RewriteRule .* http\://www.ondemandcollateral.net/IONA/index.aspx\?id=1request=$1 [I,RP]
Back to Top View Lexey's Profile Search for other posts by Lexey
 
Spec_David
Newbie
Newbie


Joined: 25 June 2008
Online Status: Offline
Posts: 11
Posted: 09 July 2008 at 9:32am | IP Logged Quote Spec_David

Works great, thanks Lexey, appreciate all the help.
Back to Top View Spec_David's Profile Search for other posts by Spec_David Visit Spec_David's Homepage
 
Spec_David
Newbie
Newbie


Joined: 25 June 2008
Online Status: Offline
Posts: 11
Posted: 09 July 2008 at 9:33am | IP Logged Quote Spec_David

Oh and just for future reference, I added an ampersand between the id and the request so asp would perceive it as two separate variables for a GET.
Back to Top View Spec_David's Profile Search for other posts by Spec_David Visit Spec_David's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum