Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Haansi 51 posts 150 karma points
    Sep 15, 2014 @ 08:34
    Haansi
    0

    showing non Umbraco View, error HTTP Error 404.0 - Not Found

    In MVC 4 application I have Nuget Umbraco CMS 7.

    I need to keep a non-Umbraco/ custom controller with view. I have created an MVC controller named Users which has an action named Index. I have updated umbracoReservedUrls in web.config as below:

    Below is my controller code:

    public class UsersController : Controller { // // GET: /Users/

        public ActionResult Index(User model)
        {
            return View(model);
        }
    
    }
    

    My view markup is as below:

    @model Common.Model.User
    
    @{
        ViewBag.Title = "Index";
    }
    
    <h2>Index</h2>
    

    Issue: On running if I navigate to http://localhost:56512/users/index, control do not come to controller and in browser I got 404 error as detailed below:

    HTTP Error 404.0 - Not Found
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
    

    Can you please guide how to fix this and navigate to non Umbraco views and controllers ?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 15, 2014 @ 08:47
    Jan Skovgaard
    1

    Hi Haansi

    You probably just need to add the path to the "UmbracoReservedPath" or "UmbracoReservedUrl" key in the web.config file.

    In your case you should be able to simply just add the /users/ folder like this

    Hope this helps.

    /Jan

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Sep 15, 2014 @ 09:08
    Jeavon Leopold
    100

    You also could register a custom route as detailed here

  • Haansi 51 posts 150 karma points
    Sep 15, 2014 @ 19:25
    Haansi
    0

    Thanks Jan Skovgaard  

     

    In web.config I m doing as below:

    <add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,~/Users/Index"/>

    My controller 'UsersController' is in MVC application inside Controllers folder and view  'Index' is inside view/Users/Index.

    Can you please guide how I should do configuration or if I m doing in wrong way. Even with this configuration message is same. Kindly advice.

  • Haansi 51 posts 150 karma points
    Sep 16, 2014 @ 01:36
    Haansi
    0

    Thanks @Jeavon Leopold, after spending days, your suggestion worked for me.

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft