Example of cookie usage in ASP

Source: Internet
Author: User

First is the foreground form field:

<form name="Login" action="loginaction.asp" method="post">

User name

<input name="User" type="text"
id="User" size="23" maxlength="20">
用户密码:<input name="Password" type="password" id="Password" size="23" maxlength="20">
Cookie选项:
<select name=CookieDate>
<option selected value=0>不保存</option>
<option value=1>保存一天</option>
<option value=2>保存一月</option>
<option value=3>保存一年</option>
</select>

<input type="submit" name="Submit" value=" 确认 ">   <input name="reset" type="reset" id="reset" value=" 清除 ">

</form>

Validate page

rs("szd_last_time")=now()
rs("szd_cookie")=cookiedate

rs.update
jibie=rs("szd_jibie")
call SaveCookie_5do8()
sub SaveCookie_5do8()
Response.Cookies("5do8")("User")=user
Response.Cookies("5do8")("Password") = PassWord
Response.Cookies("5do8")("CookieDate") = CookieDate
select case CookieDate
case 0
''''not save
case 1
Response.Cookies("5do8").Expires=Date+1
case 2
Response.Cookies("5do8").Expires=Date+31
case 3
Response.Cookies("5do8").Expires=Date+365
end select
end sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.