Custom Errors on ASP.Net MVC - redirectMode="ResponseRewrite" Issue
I assume that some of you folks have tried that in your ASP.Net MVC applications and try to figure out why it doesn't work. Well, I have figured it out...
12/8/2010 11:17:17 PM
3 comments
6032 times
Today, I was wraping up an asp.net mvc project. Make it prettier and safer. I realised that there is a thing which doesn't quite work with asp.net mvc. CustomErrors ! I wanted to refill the page, which has one or multiple errors, with a custom error page so I implemented the following code on web.config file;
Then, I hit an error on pupose just in case to see if it works or not and Boom... !! It failed ! It gave me the famous ASP.Net yellow screen of death; I was a little surprised about that and I wonder why that thing happened. So I made a little research and I opened a thread on ASP.Net MVC Forums I found out that MVC Routes are not compatible with ResponseRewrite. A smilar thread was opened on Stackoverflow.com and the answer is there as appears below;
The answer is pretty reasonable for me and I changed the RedirectMode to ResponseRedirect which is the default one. But I still wonder that ASP.Net Mvc team will fix it in next versions or not.... Comments
#122
very good job :))
re: Custom Errors on ASP.Net MVC - redirectMode="ResponseRewrite" Issue
by nihan on 12/10/10 18:49:56 Friday (UTC +00:00)
#2069
re: Custom Errors on ASP.Net MVC - redirectMode="ResponseRewrite" Issue
by Ardin on 02/16/11 18:34:43 Wednesday (UTC +00:00)
apperently, the best way of retuning 404 error is to handle them on your controller. I mean, you cannot handle all of them but you can predict that on one conditions this will going to retun a null page so lets throw 404 httpexception. But insted, create a 404 view and redrecttoview or directly retun the view as partial Additional allowed tags : [quote]...[/quote], [user]...[/user]
|
Keep in Touch with MeTagsArchive
Blogroll |




