When I try Request.UrlReferrer.ToString()
this error occures:
System.NullReferenceException: Object reference not set to an instance of an object
You have to check if UrlReferrer
is null, as it's not always set (ie, when someone typed the URL directly into the address bar, or clicked on a bookmark)...
(Request.UrlReferrer == null) ? "" : Request.UrlReferrer.ToString()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With