问题描述:

I have this site hosted in a couple of places.

http://web83.jet.studiocoast.com.au/Account/Register

http://flowerpictures.tesselaars.com/Account/Register

Both with the same code.

In a weird way http://flowerpictures.tesselaars.com/Account/Register redirect it to login.

The register action is as simple as

//

// GET: /Account/Register

public ActionResult Register()

{

return View();

}

Not sure if this might help but the register view uses

@Membership.MinRequiredPasswordLength

What works in one location doesn't in another. Both sit on the same server.

网友答案:

Looks like you're restricting anonymous users from accessing this action. This'll happen when you've set the Authorize attribute, at the class level - thus cascading accessibility down to your action methods.

Remove the Authorize attribute that's at the class level, and only add it to applicable action methods inside the class.

It'd also be good to look at the web.config and check the Authorize section where the accessibility is configured for anonymous and authenticated users:

<configuration>
    <system.web>
        <authentication mode="Forms"/>
        <authorization>
            <deny users="?"/>
        </authorization>
    </system.web>
    <location path="/account/register">
        <system.web>
            <authorization>
                <allow users="*"/>    
            </authorization>
        </system.web>
    </location>
</configuration>
相关阅读:
Top