Bài đăng

Đang hiển thị bài đăng từ tháng 6 24, 2015

404 error trong MVC

1. Webconfig. 2. ErrorController.cs 3. View>Error> Notfound.cshtml và  Unauthorized.cshtml Source:  https://github.com/chuchuva/Test404 Chi tiết: 1. Webconfig: a) Thêm dòng này: <customErrors mode="On" /> b) Thêm vào: <system.webServer>     <httpErrors errorMode="Custom" existingResponse="Replace">       <remove statusCode="404" />       <error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />       <remove statusCode="500" />       <error statusCode="500" responseMode="ExecuteURL" path="/Unauthorized" />     </httpErrors> </system.webServer> 2. ErrorController.cs         public ActionResult NotFound()         {             Response.StatusCode = 404;             return View();         }         public ActionResult Unauthorized()         {             Response.StatusCode