0

I have created application using: Default Web Site >> Right Click >> Add Application

Added following details Alias : CAFM Physical Path: path of my application Application pool: ASP.Net v4.0

Now i type following in Internet Explorer, then it is working fine. http://localhost/cafm/Authentication/logon

Routing Code:

 public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");
            routes.IgnoreRoute("Default.aspx");
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Authentication", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }

Problem: If i type only following in internet explorer then it is giving me an error http://localhost/cafm/

Error:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /cafm/

Please help me, how could i set default page to Authentication if user type only http://localhost/cafm.

Any suggestion would be appreciated! Thanks
Imdadhusen

4
  • Could you please post your routes in your mvc application? Commented Jul 21, 2011 at 5:28
  • i have updated code as per your suggestion. Commented Jul 21, 2011 at 6:02
  • is cafm an application folder? Commented Jul 21, 2011 at 6:16
  • Yes, my virtual directory name is CAFM and application physical path is D:/projects/CAFM.Web/Views/Authentication and Authentication contains following pages (.cshtml) ChangePassword, ChangePasswordSuccess, LogOn and Register. I hope now you clear. Commented Jul 21, 2011 at 6:31

1 Answer 1

2

May be your route should point to action LogOn not Index

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Authentication", action = "LogOn", id = UrlParameter.Optional } // Parameter defaults
            );

Lg
warappa

Sign up to request clarification or add additional context in comments.

1 Comment

You are 100% correct. i got the problem... Thank you very much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.