Reputation: 171178
For logging purposes i want to log the redirect target of the current request to a database. how can i read the readirect target of the current request. keep in mind that i do not want to log on every Response.Redirect. I want the logging to take place in a central location. this location might be Application_EndRequest. I have tried to read the Repsonse.Headers collection to read the location header but is is not there.
Upvotes: 1
Views: 247
Reputation: 1978
In your Application_EndRequest event, you can read the following two properties on your Response object:
Response.StatusCode will be set to 302 on redirects. Response.RedirectLocation will be set to the URL where the browser will be redirecting.
Upvotes: 1
Reputation: 23624
Can you "invert" problem? I mean property HttpRequest.UrlReferrer - can expose where you came from, so you could filter pages where UrlReferrer = 'login page' and log them to DB
Upvotes: 0