user911671
user911671

Reputation:

MVC Html ActionLink Url error?

I have two views in my MVC 2 Login and Register

In my Login.aspx i have added

    <td>Click here to <%: Html.ActionLink("[Register]", "Register") %></td>

However I am getting ReturnUrl=%2fViews%2fHome%2fRegister in my address bar redirecting it back to Login.

I referred this Stack Overflow Question and made corresponding changes in my web config but no luck.

But when in my config I changed ,

<authentication mode="Forms" >
  <forms loginUrl="~/Home/Login" timeout="2880" />

to

<authentication mode="Forms" >
  <forms loginUrl="~/Home/Register" timeout="2880" />

It worked.

I haven't changed anything in Global.asax.cs file. How can i navigate to my Register view using Html Action Link ??

Note: I am using MVC 2

Thank you All

Upvotes: 1

Views: 696

Answers (1)

Vinay Rajput
Vinay Rajput

Reputation: 372

What comes to mind is if you have checked if your register method is without the AuthorizeAttribute? Maybe you've put the AuthorizeAtrtribute on top of the controller or you you've created a BaseController with the attribute, so every controller deriving from it need the user to be authenticated

Upvotes: 1

Related Questions