| Author: ab koi apne naam se nahin jaana jayega!!!!!! 29 Aug 2006 | Member Level: Gold | Rating: Points: 2 |
string email = this.TextBox1.Text ; //user password string password = this.TextBox2.Text ; bool isPersistent = false; //Persist.Checked; //write down u r own methods for authentication //either from database or file if (Authenticat(email)) { //if user is authunticated then //get the user time from databse or file where user have metiontioed it. this will return an intger value, for example 30, 60 this is time out in minutes. int timeout=settimeout(); //this variable will be accessible automatically //on each form... //so if you have some role base system //or you want to assign some data to this user //then put this along with this ticket //as done here //supose mubi is admin and i want store this info in ticket //so that i can get it on each page //you will get this information from database that what is his roles. i am hard coding here. string username="mubi"; string userData = setrole(username); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, email, System.DateTime.Now, System.DateTime.Now.AddMinutes(timeout), isPersistent, userData, FormsAuthentication.FormsCookiePath); // Encrypt the ticket. string encTicket = FormsAuthentication.Encrypt(ticket); // Create the cookie. Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); // Redirect back to original URL. Response.Redirect(FormsAuthentication.GetRedirectUrl(email,isPersistent));
|
| Author: Kalyan 29 Aug 2006 | Member Level: Gold | Rating: Points: 2 |
Hi, The date format is like this: 8/29/2006 12:00:00 AM mm/dd/yyyy HH:MM:SS
Regards, Kalyan.
|