I use the following line of code to check if there is UrlReferrer null
@if (Request.UrlReferrer.AbsolutePath == null)
This just gives me an error:
System.NullReferenceException: Object reference not set to an instance of an object.
I am new to asp and have been hunting around, but cannot find anything that answers my question. What bothers me is to replace zero like this:
@if (Request.UrlReferrer.AbsolutePath == "/Home")
... and AbsolutePath really / Home, the code works fine, of course, I ask about the same here, but with null?
source
share