web.config 表单身份验证获取所有用户
我有一个非常简单的 asp.net 应用程序,我使用表单身份验证并将每个用户的名称/密码存储在 web.config 中:
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="l.aspx" protection="All" timeout="600">
<credentials passwordFormat="Clear">
<user name="user1" password="pass1"/>
<user name="user2" password="pass2"/>
<user name="user3" password="pass3"/>
</credentials>
</forms>
</authentication>
我希望能够简单地获取所有用户,然后将它们绑定到下拉列表。
I have a very simple asp.net application which I'm using forms authentication and storing each user's name / password in the web.config:
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="l.aspx" protection="All" timeout="600">
<credentials passwordFormat="Clear">
<user name="user1" password="pass1"/>
<user name="user2" password="pass2"/>
<user name="user3" password="pass3"/>
</credentials>
</forms>
</authentication>
I'd like to simply be able to get all users, then bind them to a dropdownlist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从类似 http://msdn.microsoft.com 的代码中读取 web.config /en-us/library/4c2kcht0.aspx
我从 msdn http://msdn.microsoft.com/en-us/library/system.web.configuration.formsauthenticationconfiguration.credentials.aspx
You can read web.config from code like that http://msdn.microsoft.com/en-us/library/4c2kcht0.aspx
I found that from msdn http://msdn.microsoft.com/en-us/library/system.web.configuration.formsauthenticationconfiguration.credentials.aspx