本文介绍了我不想在一段时间后向客户端显示我的软件的某些页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将web.config放在了项目的每个文件夹中,例如Reports,Master等,
这是报告文件夹的web.config代码
I took web.config in each folder of my project like Reports,Master etc,
This is web.config code of report folder
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authorization>
<allow roles="Administrator,Employee" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
Now if i remove Administrator
<allow roles="Employee" />
然后它不允许我直接查看报告,但是我希望在一段时间后才能得到相同的效果.因此,如何通过编码来实现.
Then it don''t allow me to see reports directly but i want same effect after some time/duration.So how can i do it through coding.
推荐答案
DateTime dt = new DateTime(2012, 10, 10);
if (DateTime.Now == dt)
{
System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("YOUR
web.config PATH");
System.Web.Configuration.AuthorizationRule authosecrole = new AuthorizationRule(AuthorizationRuleAction.Deny);
System.Web.Configuration.AuthorizationSection auth =(AuthorizationSection)configs.GetSection("system.web/authorization");
auth.Rules.Add(authosecrole);
}
希望对您有帮助...
i hope it helps you ...
这篇关于我不想在一段时间后向客户端显示我的软件的某些页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!