ASP Basic Question

Results 1 to 4 of 4

Thread: ASP Basic Question

  1. #1
    Join Date
    Dec 1969
    Posts
    569

    Default ASP Basic Question

    I would like to post a cookie on someone&#039s machine (in the windows/cookie dir on their machine.) I need to check their computer to see if they already have our cookie. If they do, send them to one page, if not, another. I also need to pull their logon name they used to get on the internet or logged on to their NT domain. If none exists, pull their name from somewhere else. I also need to be able to read the cookie and get their name. I have looked for 2 days on this site and many others and no one seems to have this example anywhere. Im not even sure if it&#039s possible to do what im asking in asp, however, if it is, I would like the source code (the whole thing as Im not familiar with cookie setting) or url where i can get it. Thank you in advance for your response.

  2. #2
    KPW Guest

    Default RE: ASP Basic Question

    I think I can help with the first part of your question.<BR><BR>Suppose you set a cookie on the user&#039s machine with the name "cookie." You could check for it like this:<BR><BR>&#060;%<BR>If Request.Cookies("cookie") Then<BR> &#039cookie exists, send to following page<BR> Response.Redirect "http://www.mysite.com/"<BR>Else<BR> Response.Redirect "http://www.mysite.com/first_time.asp"<BR>End if<BR><BR>%&#062;<BR><BR>As for the second part of your question, I&#039m not sure if it&#039s possible just with ASP. I believe there are some third part components that do this, but I&#039m not even sure where to tell you to look.<BR><BR>Anyway, I hope I was able to help with at least part of your question.

  3. #3
    KPW Guest

    Default RE: ASP Basic Question

    Sorry, I forgot to tell you how to set a cookie.<BR><BR>Suppose you want to set a cookie named "cookie" with a value of "chewy."<BR><BR>&#060;%<BR><BR>Response.Cookies("c ookie") = "chewy"<BR><BR>%&#062;<BR><BR>This sets a cookie that will persist until the user closes the browser. To make the cookie persist for, say, 10 days, do the following:<BR><BR>&#060;%<BR><BR>Response.Cookies( "cookie").Expires = Date + 10<BR><BR>%&#062;<BR><BR>

  4. #4
    KPW Guest

    Default RE: ASP Basic Question

    Oops, one minor correction.<BR><BR>Your "if" line should read<BR><BR>**If Request.Cookies("cookie") &#060;&#062; "" Then<BR><BR>The way I had it originally works fine if the cookie exists, but blows up if the cookie does not exists.<BR><BR>I hope all of this is helping!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •