开发者

Logging with asp membership from any page?

Is it possible?

It means i hope to create the widget to paste it at different pages on a site(or even in the master mage) to give users ability to quick login. Is it possible 开发者_运维知识库or all pages when login accessable have to be enumerated like this:

<authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>


As long as the page allows anonymous access, I don't see why this would be a problem. Just put a username/password field on the page and use the API to log them in:

if (Membership.ValidateUser(username, password))
{
    FormsAuthentication.SetAuthCookie(username, true / false);
}

EDIT: You probably want to SSL any page with a password field on it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜