Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Help with cookies

Avatar of sre23
sre23 asked on
Adobe Dreamweaver
13 Comments1 Solution275 ViewsLast Modified:
I'm trying to use cookies on my intranet site so that when users visit a certain password protected page, the page will look for a cookie to see if they have already logged in or not, and if they have it will forward them past the login page so they don't have to re-enter their username or password.  I believe the adding part is working (I can get a cookie onto the user's machine after they have successfully logged in once.  But my problem is reading this cookie from the users machine.  It seems that the cookie is only valid while the user's browser is open.  Once the browser is closed and the user tries to access that page again, I get a Page Cannot be Displayed error.  Here is the code:

To add the cookie after a user has logged in:
Response.Cookies("auth") = "yes"
Response.Cookies("auth").Expires = Date + 365

Then to read the cookie if they visit this login.asp page again:
MM_redirectLoginSuccess="Calendars/NewEvent.asp?ID="&Recordset1__MMColParam
MM_redirectLoginFailed="AccessDenied.htm"

If (Request.Cookies("auth") = "yes") Then
      Response.redirect(MM_redirectLoginSuccess)
End If

the MM_redirectLoginSuccess variable is the page that is displayed after you successfuly login and I want to automatically send the user there if they have this cookie (auth) with a value of yes.  

If you need to see more code just ask!

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Saqib Khan
Saqib KhanFlag of United States of America imageSenior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answers