C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Cookie


Posted Date: 29 Aug 2006      Total Responses: 2

Posted By: PramodKumar       Member Level: Gold     Points: 2


Hi,

I have created a Cookie; httpCookie myck=new httpCookie("username","prmod");myck.Expires=<tomorrow's date>

pls tell me how the date format should be.




Responses

Author: ab koi apne naam se nahin jaana jayega!!!!!!    29 Aug 2006Member Level: GoldRating:     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 2006Member Level: GoldRating:     Points: 2
Hi,
The date format is like this: 8/29/2006 12:00:00 AM

mm/dd/yyyy HH:MM:SS

Regards,
Kalyan.


Post Reply
You must Sign In to post a response.
Next : Is there any file size constraint on fileupload control
Previous : please give me Transaction code using asp.net with c#(code behind page) and sql code also
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

efax

Contact Us    Privacy Policy    Terms Of Use