Well... the output from ToString can never be null - it can be an empty string, but it can't be null, so you test will either throw an exception or always return the value - it is thus worthless.
Even in it could, it boil down to:
x = a != null ? a : null;
Which mean this it always returns the value of "a" anyway: if it's null, it sets "x" to null, if it isn't it sets "x" to the value of "a".
So...you problem is somewhere in here:
Page.RouteData.Values["subcategorySEOName"]
And we can't tell which from here: we don't have access to your code running.
But basically, what is happening is that one of the elements to the left of a "." is
null
, or the whole thing is, in which case the attempt to convert it to a string with ToString will throw the null reference exception.
Put a breakpoint on the line above the one giving the error and use the mouse to hover over each part in turn - find which one is
null
and you can start looking for why your code has let it be null.
Sorry, but it's over to you and the debugger, I'm afraid.