ASP.NET Impersonation design -


this asp.net authentication operation.

    private void loginbutton_click(object sender,                        eventargs e)     {         string username = txtusername.value;         string password = txtuserpass.value;          if (validateuser(txtusername.value, txtuserpass.value))         {             formsauthenticationticket tkt;             string cookiestr;             httpcookie ck;             tkt = new formsauthenticationticket(1, txtusername.value, datetime.now,                                                 datetime.now.addminutes(3), chkpersistcookie.checked,                                                 username + "@ticket");             cookiestr = formsauthentication.encrypt(tkt);             ck = new httpcookie(formsauthentication.formscookiename, cookiestr);             if (chkpersistcookie.checked)                 ck.expires = tkt.expiration;             ck.path = formsauthentication.formscookiepath;             response.cookies.add(ck);              string strredirect;             strredirect = request["returnurl"];             if (strredirect == null)                 strredirect = "myaccount.aspx";             response.redirect(strredirect, true);         }         else             response.redirect("logon.aspx", true);      } 

i have user table in db credentials saved. using validateuser method doing credentials validation. have 3 type of users: member, moderator , administrator. each type of members has unique functionality. lets have a, b , c t-sql stored inside in db.

what should to let for:

member execute query.

moderator execute , b.

administrator execute a,b , c.

of course, can manage execution web app, not sure how safe is. technically can execute similar query outside of app, gives access db data. want somehow combine web app login , db access well.

thanks!

if these queries going come web app, think want manage code side invokes procedures.. maintain list of urls in database, assign roles, , give these roles access specific urls. these urls dictate queries user execute...

then in code assign custom attributes limit access them....


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -