开发者

Get ID of a user in ASP.NET memebership

i have just open a new website in ASP.NET Visual Studio 2010(Not using mvc).

i register into the asp.net membership.

lets say :

my username is :admin. 
开发者_运维技巧email :admin@mpsiteil.com..
pass:123..
the page name : admincontrol. 

--

and i want that a page will showed only to user "admin".

how can i do that?


this will lock down the entire site so that only admin can view it

<authorization>
  <allow users="admin" />
  <deny users="*"/>
</authorization>

this will lock down a specific path

<location path="/admins_only">
  <system.web>
    <authorization>
      <allow users="admin"/>
      <deny users="*" />
    </authorization>
  </system.web>
</location>


Authorization in ASP.NET WebForms is easily configurable via web.config:

Setting authorization rules for a particular page or folder in web.config

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜