TheAlbear
TheAlbear

Reputation: 5595

Getting URL that caused 404 error C#

Is there away to find out the URL that has caused the 404 error.

I have a custom error page set up, and within that I am trying to catch what the URL that caused the 404 error is.

Getting the requested URL just returns the current 404 page.

Upvotes: 0

Views: 775

Answers (1)

Kevin Hendricks
Kevin Hendricks

Reputation: 785

If you are looking for the page that actually threw the error, it will be posted to the query string when directed to your custom error page.

Request.QueryString["aspxerrorpath"];

Upvotes: 1

Related Questions