Trying to check if urlreferrer is null

jeckgardy

New Member
I am using the following line of code to check if the \[code\]UrlReferrer\[/code\] is \[code\]null\[/code\]\[code\]@if (Request.UrlReferrer.AbsolutePath == null)\[/code\]It just gives me an error of:\[code\]System.NullReferenceException: Object reference not set to an instance of an object.\[/code\]I'm new to asp and have hunted around but can't seem to find anything that will answer my question. The thing that confuses me is if I replace null like so:\[code\]@if (Request.UrlReferrer.AbsolutePath == "/Home")\[/code\]...and the AbsolutePath is indeed /Home, the code works fine, surely I'm asking for the same thing here but with \[code\]null\[/code\]?
 
Back
Top