Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Where to check authorize/activate?

$
0
0

OK - I use the create user wizard with additional fields. At the end I want to make the user get an email that they must answer in or to activate their account. I think I know how to do that. I have a column in the user table called activated which defaults to false and is changed to true when they answer the email. The folder that contains the home page and others that can be seen by an anonymous user has links to restricted pages which can't be seen until you have logged in. However just because you are authorized doesn't mean you have been activated. Since all of the restricted ages have the same master page I thought I could check the activated flag there, but the master page actually runs last. I should be redirecting them to a page   that resends them an email, but can I do that if he have already gone to the page? I suppose I could run the

ublic partial class Profile_profile : System.Web.UI.MasterPage
{
     public int rid;

    protected void Page_Load(object sender, EventArgs e)
    {
       HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
        rider rd = new rider();
        
        if (Request.IsAuthenticated)
        {


            FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

            rid = Convert.ToInt32(authTicket.UserData);
            string uid = rd.getuseridfromrid(rid);
            utility ut = new utility();
            bool active = ut.isactivated(rid);
         
            if (active == false)
                Response.Redirect("~/Main/home.aspx");

This is the master page script.

Thanks, Dave
code on each page but that seems overkill.


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>