ajaymaster143
asked on
nullreferenceexception was unhandled by user code
i get this error on
Exception ex = Server.GetLastError();
if (ex.InnerException != null ) ex = ex.InnerException;
i don't understand why this error come.
Exception ex = Server.GetLastError();
if (ex.InnerException != null ) ex = ex.InnerException;
i don't understand why this error come.
Have you checked that Server.GetLastError() is actually returning a valid object?
ASKER
it's return null value.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The that is why you are getting a Null reference then. You are checking ex.InnerException without first checking that ex itself isn't null.
Even this will work:
if(ex != null )
{
// process
}
if(ex != null )
{
// process
}
try this
string ex = Server.GetLastError().ToSt ring();
string ex = Server.GetLastError().ToSt