I use a C# class to Fill a DataTable and return it. My problem is I have to do a Try...Catch in the event of errors but I can't send back the Exception Error string, only the DataTable can be sent back. I tried writing the exception error into a Cookie in the Class but it won't compile - it keeps rejecting the "Response" part of the code, and adding namespaces from where I have no problem writing cookies has not solved the compiler problem.
Any other options or ways to get around this problem? Thanks.
catch (Exception exc)
{
string strError = exc.ToString();
HttpCookie ErrorCookie = new HttpCookie("ErrorCookie"
;
ErrorCookie.Value = strError;
Response.Cookies.Add(ErrorCookie);
}
Any other options or ways to get around this problem? Thanks.
catch (Exception exc)
{
string strError = exc.ToString();
HttpCookie ErrorCookie = new HttpCookie("ErrorCookie"
ErrorCookie.Value = strError;
Response.Cookies.Add(ErrorCookie);
}