Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Need help to creat cooki for loging
Old 12-19-2010, 02:01 PM Need help to creat cooki for loging
Junior Talker

Posts: 2
Name: Jwana
Trades: 0
HI
I am usinf classic asp to create a website
I am trying to creat a login page then to add cooki to my web site wher the user if they login once the cooki will rember them as long as the webpage is open

I think I need to creat a session first and Buffer but I dont know how ?

I'll attach my asp codes for the lgin page hear

many thx
==============================================
Code:
<!-- #INCLUDE FILE = "DBconnection.inc" -->
<!-- #INCLUDE FILE = "success.asp" -->
 <a href="logout.asp">logout</a>

<html>
<head> </head>
 <body>
   
    
     <FORM METHOD=POST ACTION="loginproc.asp">
       Username: <INPUT TYPE=TEXT NAME="user_username">
       <P>
       Password: <INPUT TYPE=PASSWORD NAME="user_password">
       <P>
       <INPUT TYPE=RESET> <INPUT TYPE=SUBMIT>
     </FORM>

Or click <a href="addinguser.asp">here </a>to become a new user

 </body>
</html>
==============================================

Last edited by chrishirst; 12-19-2010 at 02:03 PM..
aliali88 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-19-2010, 02:04 PM Re: Need help to creat cooki for loging
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.w3schools.com/ASP/asp_cookies.asp
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-21-2010, 12:41 PM Re: Need help to creat cooki for loging
Junior Talker

Posts: 2
Name: Jwana
Trades: 0
Quote:
Originally Posted by chrishirst View Post

ok I've been reading this website but I can not apply it to my case

can you please make some codes and put it hear
aliali88 is offline
Reply With Quote
View Public Profile
 
Old 12-21-2010, 12:50 PM Re: Need help to creat cooki for loging
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I could, but if you don't know how to apply the code from W3Schools to your code, how are you going to be able to apply any code that I write.

All you need to set is a boolean for logged-in to true and a value to hold the username.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-28-2010, 02:32 PM Re: Need help to creat cooki for loging
Novice Talker

Posts: 5
Name: Carl
Trades: 0
What you are seeking to do is reasonably easy, just an addition to the page with your login, which will take your username or similar and set the cookie using it.
By default sessions are created when someone logs into a website, this lasts until the browser is closed or they select Logout.
You can set sessions if this is all you need.
Cookies are intended when you wish to keep information for longer periods, such as a week, month or years.
I assume your form posts to a page which checks the username/password against the database then logs then in if they exist.
If so, then after this code and before any redirecting occurs, you need to add some code to set the cookie.
Below is a quick example from the link the other user gave you.

Response.Cookies("username")=Request("user_usernam e")
Response.Cookies("username").Expires=Date()+30

this sets a cookie called 'username' which has the name from the form and will expire in 30 days.

If you really only need it to last whilst they have the browser open or log out, then a Session is much better, as it does not need to store anything long term.

As above, after your log in script, just add

Session("username") = Request("user_username")

That will mean you know the user logged in and will allow you to show their Username at anytime whilst they are logged in.

I tend to set their ID from the database, as this means you can query their records without having to check or ask for more information.

This just requires a quick query following login for their record, although if you use their 'username' to identify them, then that is enough.

Whichever way you go, make sure the Session or Cookie code is not called until you are sure they have an account, i.e the code which checks has run and is positive. Else someone will just be able to use the site by trying to log in.

I hope that is useful, if you have any queries, send me a message )
CGW3 is offline
Reply With Quote
View Public Profile
 
Old 12-29-2010, 03:09 AM Re: Need help to creat cooki for loging
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
http://pscode.com/vb/scripts/ShowCod...=9194&lngWId=4 .
This will direct you to download an archive. It's a sample application for authentication and user login. Allows multi user login as well.
Go through code, help files are also provided.
If you still didn't get it. Ask again!
phazorRise is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need help to creat cooki for loging
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.58947 seconds with 12 queries