Roel,
The quick answer is to URL-encode the string using the UrlEncode method of
the Server object. However, this is not a good general solution since the
limitations on query string lengths are likely to cause eventual problems.
A better solution is to not pass the error message via the query string at
all. You might want to try either a server-side redirection or storing the
exception information in a session variable for retrieval on the error page.
HTH,
Nicole
"Roel" <vd*****@pandora.be> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
Hello
When I have an exception within a try - catch block, I sent the user to my
error page with the following code:
Response.Redirect(@"error.aspx?errmsg=" + ex.Message + "&errsource=" +
ex.Source + "&errstack=" + ex.StackTrace);
The problem is that when there is an \n - sign in the error message or
stacktrace, I get the error "Redirect URI cannot contain newline
characters"
Is there anybody who knows how I can transform the "ex.Message" into a
@string or is there another way to solve this problem
Regards
Roel