We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Issue with asp.net routing

The thing is that I have one account controller and in that, I have 2 methods as below and created the routes as like below in global.asax
Global.asax:-
routes.MapRoute("RouteAccountNewAccount", GlobalData.accountRoute + "/NewAccount/{language}/{email}",
              new
              {
                  controller = GlobalData.AccountControllerName,
                  action = "NewAccount"                  
              },

              new
              {
                  httpMethod = new HttpMethodConstraint("GET")
              });
            routes.MapRoute("RouteAccountNewAccountForInvalidEmail", GlobalData.accountRoute + "/NewAccountForInvalidEmail/{language}",
             new
             {
                 controller = GlobalData.AccountControllerName,
                 action = "NewAccountForInvalidEmail"
             },

             new
             {
                 httpMethod = new HttpMethodConstraint("GET")
             });

In Account controller:-

public ActionResult NewAccountForInvalidEmail(AccountViewModel model, string language)
        {
........
return View("NewAccount");
        }

public ActionResult NewAccount(AccountViewModel model, string language, string email)
        {
.......
return Json(response, JsonRequestBehavior.AllowGet);
}

It is working fine in development environment. But when we moved the same code to prod, we are facing an error as like"index.cshtml is not found".

Could you please let me know whether the order of routing in global.asax file is creating the problem?


1 Reply

SN Sasikala Nagarajan Syncfusion Team March 23, 2016 09:11 PM UTC

Hi Soumya,

Thanks for contacting Syncfusion support,

We have checked with your query and given code example. While analyzing more with your reported issue, we suspect that the  issue may be caused due to the  “Index.cshtml” view page file is missed under the views section in an application when index file is called from that corresponding controller action result.  Please refer the below code example

public class HomeController : Controller

    {

        public ActionResult Index()

        {

            return View();

// This will search for view page (index.cshtml) under the Home folder in Views section to load in a browser, if this file is missed then the issue will arise as you reported
        }


So can you please ensure with your application whether you have added the all required cshtml  files under the view section and returned the views from controller with proper naming.
Still if you are facing any difficulties please provide more information about your sample with controller section, route map configuration details, so that we can check  in our side and provide the better solution

Please let us know if you need any further assistance,

Regards,

Sasikala Nagarajan



Loader.
Live Chat Icon For mobile
Up arrow icon