Answered by:
custom 404 webpage

Question
-
User-1232255770 posted
How can I implement / configure a custom 404 webpage on azure websites ?
I created an controller and view ~/Error/custom404
thanks
Friday, September 12, 2014 8:43 AM
Answers
-
User541108374 posted
Hi,
take a look at this one:
<customErrors mode="On" defaultRedirect="~/Error"> <error redirect="~/Error/NotFound" statusCode="404" /> </customErrors>
and controller:
public class ErrorController : Controller { public ViewResult Index() { return View("Error"); } public ViewResult NotFound() { Response.StatusCode = 404; //you may want to set this to 200 return View("NotFound"); } }
Credit: http://stackoverflow.com/questions/13905164/how-to-make-custom-error-pages-work-in-asp-net-mvc-4.
From your original question I made up that you knew how to go for that scenario in MVC and were only wrestling with the Azure part.
Grz, Kris.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, September 15, 2014 5:40 AM
All replies
-
User541108374 posted
Hi,
you can adjust the web.config to have it set up like this:
<system.webServer>
<httpErrors existingResponse="PassThrough" /> </system.webServer>Grz, Kris.
Friday, September 12, 2014 9:12 AM -
User-1232255770 posted
Helllo,
but how to map to a custom 404 file / mvc route ?
best regards,
Monday, September 15, 2014 1:37 AM -
User541108374 posted
Hi,
take a look at this one:
<customErrors mode="On" defaultRedirect="~/Error"> <error redirect="~/Error/NotFound" statusCode="404" /> </customErrors>
and controller:
public class ErrorController : Controller { public ViewResult Index() { return View("Error"); } public ViewResult NotFound() { Response.StatusCode = 404; //you may want to set this to 200 return View("NotFound"); } }
Credit: http://stackoverflow.com/questions/13905164/how-to-make-custom-error-pages-work-in-asp-net-mvc-4.
From your original question I made up that you knew how to go for that scenario in MVC and were only wrestling with the Azure part.
Grz, Kris.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, September 15, 2014 5:40 AM