Click here to Skip to main content
13,347,998 members (69,259 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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"?>
      <allow roles="Administrator,Employee" />
      <deny users="*" />
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.
Posted 26-Sep-12 3:57am
Updated 26-Sep-12 4:35am
source.compiler 26-Sep-12 9:10am
you want administrator see that folder in a time range?
mu-kul 26-Sep-12 9:24am
at Beginning (for few days/month) administrator can see it but not after that
can i put some condition on which administrator should be remove.Just want to remove Administrator role from allow role tag.
Sergey Alexandrovich Kryukov 26-Sep-12 11:08am
Why would you want to abuse the nature of the Web? You should better review your design and motivation of your decision. It's the best to assume the point of view of your customer.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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");

i hope it helps you ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180111.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100