While you send the error message as query string to an error page using response.redirect method in asp.net, you may come across the following error.
To get through, you should use URLEncode and URLDecode alone or with combination of HTMLEncode and HTMLDecode.
Eg:-
Response.Redirect(@"~/errorpage.aspx?.err=" + Server.UrlEncode(exception.Message) + "&.src=" + Server.UrlEncode(exception.Source));
Subscribe to:
Post Comments (Atom)
2 comments:
Hi,
ur solution works fine if same web page..bt what if i wan to have a class method to redirect to a errorpage in case of exception..
first error--Server.urlencode
it won't identify server control n i have to pass httpserverutility object..
is that the only feasible way..
can u suggest sumthng else..
Nishitha-
It will work well in a class object as well. I used to have that routine in my all codings.
You can get the encode and decode using the proper System namespaces within the reusable class.
Let me know if you have further questions.
Post a Comment