c# - yet another forum form authentication problem asp.net -
i developing application in integrated yaf forum 1 problem facing when user login in application , move page yaf:forum integrated again need login in forum, current forum authentication code
string usrname = txtusername.text; string password = txtpassword.text; int expdate = 0; expdate = 10000; string userdata = dtuser.rows[0].itemarray[0].tostring() + "," + dtuser.rows[0].itemarray[1].tostring() + "," + dtuser.rows[0].itemarray[2].tostring() + "," + dtuser.rows[0].itemarray[3].tostring() + "," + dtuser.rows[0].itemarray[4].tostring() + "," + dtuser.rows[0].itemarray[5].tostring() + "," + dtuser.rows[0].itemarray[6].tostring(); formsauthenticationticket authticket = new formsauthenticationticket(1, usrname, datetime.now, datetime.now.addminutes(expdate), false, userdata); string encryptedticket = formsauthentication.encrypt(authticket); //'check encryptedticket should not nothing'''''''''' if (encryptedticket == null) { formsauthenticationticket authticketwithnopages = new formsauthenticationticket(1, usrname, datetime.now, datetime.now.addminutes(expdate), false, userdata); encryptedticket = formsauthentication.encrypt(authticketwithnopages); } httpcookie authcookie = new httpcookie(formsauthentication.formscookiename, encryptedticket); httpcookie authcookie2 = new httpcookie("authcookie2"); formsauthentication.setauthcookie(usrname, true); //if comment line below no data of user shown response.cookies["mm"].value = formsauthentication.encrypt(authticket); response.cookies["mm"].path = "/"; //session.add("intuserid", userid) response.cookies["pin"].value = ""; authcookie2["username"] = txtusername.text; //authcookie2("userid") = session.item("intuserid") authcookie2["password"] = txtpassword.text; // authcookie2("superadmin") = session.item("superadmin") authcookie2["userdata"] = userdata; //authcookie2("sbforms") = session.item("sbforms") authcookie2.expires = system.datetime.now.addminutes(expdate); //authcookie2.domain = ".loudclick.us" //authcookie.domain = ".loudclick.us" response.cookies.add(authcookie); response.cookies.add(authcookie2);
and web.config setting
<authentication mode="forms"> <forms name=".yafnet_authentication" loginurl="private/login.aspx" protection="all" timeout="43200" cookieless="usecookies"/> </authentication>
can me out solve issue.
Comments
Post a Comment