是否有网页保护ASP.NET网站,所以它要求用户输入用户名/密码才能查看的方法吗?网络保护ASP.NET网站
有人告诉我,这应该在web.config文件,但不知道如何做到这一点的话还是应该去那里。任何帮助非常感谢。
是否有网页保护ASP.NET网站,所以它要求用户输入用户名/密码才能查看的方法吗?网络保护ASP.NET网站
有人告诉我,这应该在web.config文件,但不知道如何做到这一点的话还是应该去那里。任何帮助非常感谢。
如果它是Intranet方案也很简单。在你的web.config互联网应用程序添加此
<configuration>
<system.web>
<authentication mode=”Windows” />
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>
的最快方法:
<authentication mode="Forms">
<forms loginUrl="~/login.aspx">
<credentials>
<user name="user" password="password" />
<user name="user2" password="password2" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
您还需要一个新的页面login.aspx的一个形式,其中用户可以输入自己的凭据。在网页后面的代码然后需要将以下代码:
string username = textBoxUsername.Text;
string password = textBoxPassword.Text;
if (FormsAuthentication.Authenticate(username, password))
FormsAuthentication.RedirectFromLoginPage(username, false);
嗨,它不是企业内部网和网站托管的是Microsoft Web服务器上,因此我们需要发出一个用户名/密码让全世界都可以看到它的人们登录。 – user1114714 2012-01-06 13:10:22
查看我的更新回答。 – KMan 2012-01-06 13:20:44
您好,感谢这一点,我可以简单地添加到Web.config文件和所有将被罚款我需要什么,少了需要做什么吗? – user1114714 2012-01-06 13:22:03