JNF
JNF

Reputation: 3730

Identify 404 Source from within a page

I catch all 404 responses returned from my site (aspx 404 page) and log them. Is there a way for me to know if the request was made directly from the browsers' address bar, or referenced by clicking a link - or if it was requested as part of another page?

Upvotes: 2

Views: 70

Answers (1)

Anders Abel
Anders Abel

Reputation: 69260

Check the HttpContext.Current.Request.UrlReferrer property. If the request was a result of a link from another page the property should contain that page's URI. If the address was entered directly that property should be blank.

Good idea by the way to log dead links.

Upvotes: 2

Related Questions