troubleshooting Question

Allowing and Denying multple roles in Web.config

Avatar of wilcor14
wilcor14Flag for United States of America asked on
.NET ProgrammingASP.NET
5 Comments1 Solution323 ViewsLast Modified:
Need some help with logic and insight on membership provider in .net 2.0 and vb.

I have my main site that anyone can access. I have a subfolder that requires users to be authenticated. The first time a user logs in, I am trying to verify a code that was sent to them in an email. So my plan was to create a page called VerifyCode.aspx and allow all access to this page in my subfolder. When a user first creates an account, they are assigned a role called UnvalidatedEmails and when they verify the code correctly, they are removed from this role. In addition to this role, they are assigned other roles. OK so below is my web.config file within my subfolder. My thought process was that when the user logs in, and the system finds the user in the UnvalidatedEmail, it would redirect it back to the login page which is where I redirect the page to the verifycode.aspx page.

Can anyone explain why this is not happening? Thanks for your time.


<configuration>
  <system.web>
<authorization>
      <deny users="?" />
      <allow roles="FreeTrial" />
      <allow roles="Registered" />
      <allow roles="Subscriber" />
      <allow roles="Modirator" />
      <allow roles="OfficeStaff" />
      <deny roles="UnvalidatedEmail"/>
    </authorization>
  </system.web>
 
  <location path="VerifyCode.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="login.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
</configuration>
ASKER CERTIFIED SOLUTION
Melih SARICA
Melih SARICA

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros