Bruce Chapman
Bruce Chapman

Reputation: 1247

IIS Log Files showing Rewritten rather than Original Url

I've got a problem in that changing the way I'm doing Url Rewriting in an Asp.Net application has changed the IIS log files from looking like this:

/page/ 80 etc.. /page/anotherpage/ 80 etc...

to

default.aspx page=1 80 etc... default.aspx page=2 80 etc...

I'm a bit stumped as to how this happened. Is there a setting I'm missing (Win 2008, ASP.NET 2.0) The 'runAllManagedRequests' setting in the has also been switched on.

Upvotes: 4

Views: 3815

Answers (4)

David
David

Reputation: 34563

This question is a duplicate.

I've had exactly the same problem. One way around this is to use Server.Transfer instead of Context.RewritePath. Server.Transfer doesn't restart the entire page lifecycle so the original URL will still be logged. Be sure to pass "true" for the "preserveForm" parameter so that the QueryString and Form collections are available to the 2nd page.

Upvotes: 0

Daniel Richardson
Daniel Richardson

Reputation: 5284

Is the URL rewriting being done by a module? If it is, then it's possible the rewriting module is running before the logging module. You can change the order that modules run in IIS Manager. Go into Modules in IIS Manager and select View Ordered List...; then you can move modules up and down into the order you want.

Upvotes: 2

TheAlbear
TheAlbear

Reputation: 5585

As far as i am aware this will be by design as IIS only ever recives the rewritten URL not the orignal, as the rewritten url is sent to the .Net appliction and its the appliction that dose the converting.

Upvotes: 0

Mark Bell
Mark Bell

Reputation: 29785

I don't know what method you are using to rewrite the URLs, but I know that with Apache (and ISAPI_Rewrite on Windows) you have to add a flag to each rule in the .htaccess file (or equivalent) to tell it to log the rewritten URL and not the original.

Upvotes: 0

Related Questions