How do I handle a NullReferenceException for the statement below, since I get a null exception error for the statement below if it is not present in the query string when using URL routing
string lang = RouteData.Values["Language"].ToString();
Error Details
Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it appeared in the code.
Exception Details: System.NullReferenceException: The object reference was not set to the object instance.
source
share