I have created an web application with MVC template.I have created a custom view -Login.cshtml .


        <div id="Email">
        <div id="Password">
        <input id="LoginBtn" type="submit" value="Login" />

In my controller method if i use [authorize] attribute,it takes me to /Accounts/Login by default which is already available in the template.


    public ActionResult Start()
       return View();

I need the authentication view as Login.cshtml. So, I tried adding the forms authentication in Configuration file (web.config)


<authentication mode="Forms">
  <forms name="xyz" loginUrl="http://localhost:2680/My/Login">
      <user name="abc" password="pass123" />

Even after adding it , the Accounts/Login ran instead of My/login.

So my question is how to use a custom view for login when we specify [authorize] attribute in controller methods?

Related posts

Recent Viewed