Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Go Back  Xtreme Visual Basic Talk > > > Cookie Code not working {ASP.NET}


Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2006, 08:22 PM
tonymaclennan tonymaclennan is offline
Contributor
 
Join Date: Sep 2004
Location: Lincolnshire
Posts: 402
Default Cookie Code not working


Code:

Quote:
'##################################################################### ###############
'set the cookie
' Create a cookie object - I'm passing name and value,
' but you can also pass in a name and set the value later.
' ie. objCookieObject = New HttpCookie(COOKIE_NAME)
PASSWORD_COOKIE_VALUE = password
Username = txtUsername.Value.Trim
USERNAME_COOKIE_VALUE = Username
objCookieObjectUsername = New HttpCookie(USERNAME_COOKIE_NAME, USERNAME_COOKIE_VALUE)
objCookieObjectPassword = New HttpCookie(PASSWORD_COOKIE_NAME, PASSWORD_COOKIE_VALUE)
' We alreay set these above!
'objCookieObject.Name = COOKIE_NAME
'objCookieObject.Value = COOKIE_VALUE

' Additional cookie properties:
objCookieObjectUsername.Expires = System.DateTime.Now.AddMinutes(60)
objCookieObjectPassword.Expires = System.DateTime.Now.AddMinutes(60)
' Normally you can leave these alone.
' The defaults will work fine for most uses.
'objCookieObject.Domain = "www.domain.com"
'objCookieObject.Path = "/path/"
'objCookieObject.Secure = True

Response.AppendCookie(objCookieObjectUsername)
Response.AppendCookie(objCookieObjectPassword)
'end set cookie
'##################################################################### ###############
It creates 2 cookies! Does not work though! I uploaded to my host but it does not create the cookies!

Any ideas?
Thanks

You can test it here with username/pass: test

I use VB VS.NET 2003
Reply With Quote
  #2  
Old 09-14-2006, 07:58 AM
wayneph's Avatar
waynephCookie Code not working {ASP.NET} wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

I got the cookies. They were set to stay for an hour. Just like you asked.

Code:
NAME  LogInUsernameCookie 
VALUE  test 
DOMAIN  www.digitalracks.com 
PATH  / 
EXPIRES  9/14/2006 9:51:59 AM 

NAME  LogInPasswordCookie 
VALUE  test 
DOMAIN  www.digitalracks.com 
PATH  / 
EXPIRES  9/14/2006 9:51:59 AM
That being said, NEVER store username and password unencrypted in a cookie. It is VERY insecure.

Since you are using .NET 1.1 take a look at FormsAuthentication. It will build the cookies for you using a Hash. It will also allow you to set up your security in the web.config file, and have the site automatically protect requested files.

System.Web.Security.FormsAuthentication
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET} Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
 
Cookie Code not working {ASP.NET}
Cookie Code not working {ASP.NET}
 
-->