如何限制网址访问; [英] How to restrict the url access;
本文介绍了如何限制网址访问;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此代码限制网址访问;
I m using this code to restrict the url access;
<authentication mode="Forms">
<forms name="Authen" protection="All" timeout="60" loginUrl="Login.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
但我无法获得母版页设计。如果我使用这个代码,设计格式完全改变了。
But i m not able to get the master page design. design format totally changed if i use this code.
推荐答案
你应该通过添加你的文件夹来获取所有用户可以访问的contet文件(.css,images等)配置如下一个例子。
You should make your folder where the contet files (.css, images, etc) accesible to all users by adding configurations like in the next example.
<location path="Content">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
我得到了解决方案我维护了一个会话来存储角色,如果我提到的角色不存在意味着我们无法通过网址打开
i got the solution i maintained a session to store the role and if the role what i mentioned is not there means we cant open thru the url
if ((Session["Email"] == null || Session["Email"].ToString() == "") && (Session["Role"].ToString() != ResourceManagementConstants.str_Resource))
{
Response.Redirect("../Login.aspx");
}
这篇关于如何限制网址访问;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文