404 Error Asp.net 4.0
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ASP.NET 4.0 URL Routing HTTP Error 404.0 - Not Found up vote 12 down vote favorite 11 I have implemented URL routing in ASP.NET 4.0 using following route. routes.MapPageRoute( "NewsDetails", // Route name "news/{i}/{*n}", // Route URL "~/newsdetails.aspx" // Web page to handle route ); which gives me url like http://www.mysie.com/news/1/this-is-test-news and this is working in my localhost fine. But when I uploaded it on the server it gives ... Server Error 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. If I try http://www.mysie.com/news/1/this-is-test-news.aspx then it displays page. Has anyone have same problem? How can i set URL http://www.mysie.com/news/1/this-is-test-news to work on windows server 2008 ? routing asp.net-4.0 share|improve this question edited Nov 25 '12 at 15:26 SteveC 4,029125096 asked Aug 19 '10 at 15:15 Pragnesh Patel 1,02931531 Is the file with the route in the same directory as that of the aspx page? –XstreamINsanity Aug 19 '10 at 15:19 no. my aspx files are at root folder –Pragnesh Patel Aug 19 '10 at 15:26 add a comment| 3 Answers 3 active oldest votes up vote 31 down vote accepted To enable default ASP.Net 4.0 routing with IIS 7.5: Make sure that you have installed the HTTP Redirection feature It can be done -> Control Panel -> Progams -> Turn off windows features -> World wide web Services -> Common HTTP Features -> HTTP Redirection Modify your web.config with the code below here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Handling 404 error in asp.net 4.0 with Url routing? up vote 0 down vote favorite I am using url routing in asp.net 4.0 (web form). On server, when any http://stackoverflow.com/questions/3523264/asp-net-4-0-url-routing-http-error-404-0-not-found user tries to type any url or change the url pattern then i end up with 404 error. How to handle this? Please guide me. Thanks. asp.net http-status-code-404 url-routing asp.net-4.0 share|improve this question asked Jun 26 '13 at 18:42 Abhishek Ranjan 1,04741434 Use a custom 404 error page??? We have no idea what you are asking... –Brad M Jun 26 '13 at 18:44 We're going to need the route parameters from the route table http://stackoverflow.com/questions/17328009/handling-404-error-in-asp-net-4-0-with-url-routing and the url typed into the browser at the very least in order see what's wrong. –welegan Jun 26 '13 at 18:53 when i try to change the url pattern on server then I get the generic IIS7 404 page but i would like redirect to my '404-page-not-found' page. So asking to how to do? –Abhishek Ranjan Jun 26 '13 at 18:53 @welegan: It could be any url. Not specific. if any user tries to change the url pattern and if it doesn't match in route table then i end up with IIS7 404 page (generic) –Abhishek Ranjan Jun 26 '13 at 18:56 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote I see, so this question is about having a custom 404 error page, not why the 404 is coming up for a specific route. In order to handle custom errors in MVC, you can override your controller's protected override void OnException(ExceptionContext filterContext) { } method. If you are using webforms, then your best bet is to use the web.config's custom errors element. See msdn documentation for the customErrors web.config element. Example: October 02, 2009 3:21 PM As mentioned at the end of my previous post on handling errors with http://www.andornot.com/blog/post/Handling-404-errors-with-ASPNET.aspx ASP.NET, handling "404 Not Found" errors are particularly problematic (if you https://forum.synology.com/enu/viewtopic.php?t=76177 haven't read it yet, please do so). And looking around, the vast majority of information out there on it is not complete, misinformed, or flat-out wrong (but I greatly appreciate all efforts!). And I would argue that this is because ASP.NET implementation of 404 error handling 404 error is flat-out-wrong. So with my super hero cape on, here I come to wobbly save the day! The typical ASP.NET way to handle 404 errors is to put something like the following in your Web.config: is currently Thu Sep 29, 2016 10:39 pm All times are UTC+01:00 Information You have been permanently banned from this board.Please contact the Board Administrator for more information.A ban has been issued on your IP address. Board index All times are UTC+01:00 Delete all board cookies Powered by phpBB Forum Software © phpBB Limited