|
| ||||||||||
| Tags: asp, asp sessions, cookies, java, receive, send |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| How to Send and Receive Cookies in ASP?
I have recently started with the Active Server Pages (ASP). I know the purpose of the cookies. I have tried them to send and receive in Java. But I don't know how to Send and Receive Cookies in ASP? I have tried many different methods, but was not successful. Since, I am new to ASP, I request to all that please explain me considering the newbie. Some sample of coding would be really grateful. Hoping that someone would help me soon.!! ![]()
__________________ |===================| |YAY if that made sense...| |===================| |
|
#2
| ||||
| ||||
| Re: How to Send and Receive Cookies in ASP?
For identifying an user, a cookie is used. I think that you should know more about the cookie. Once, if you know the actual functions of cookie, then it might help you while designing the code. A small file that the server embeds on the user's computer can be called as cookie. Whenever, the same computer requests a page with a browser, it will have to send a cookie. You can create as well as retrieve cookie values, by using an ASP. The function of ASP sessions are also very much similar to cookie. Similarly like ASP Sessions, ASP Cookies are used to store information specific to a visitor of your website. |
|
#3
| ||||
| ||||
| Re: How to Create Cookies in ASP?
You should know how to create cookies in ASP.!! Since, you said that you are new, I think that creating a cookie is important for you. For creating a cookie the "Response.Cookies" command is used. You must keep in mind that you will have to write the Response.Cookies command before the <html> tag. You can see the following example : Code: <%
Response.Cookies("carname")="HondaCity"
%> You can also set the date when you want the cookie to expire. I have explained the same thing in following code : Code: <%
Response.Cookies("carname")="HondaCity"
Response.Cookies("carname").Expires=#March 16,2010#
%> |
|
#4
| ||||
| ||||
| Re: How to Send and Receive Cookies in ASP?
I am assuming that you are clear with the cookies concept. You can use the response.cookies collection object for sending the cookies to the browser. I have provided you with the syntax and comments, so that it would be easy to understand you. The following is used to send a cookie : Quote:
Quote:
|
|
#5
| ||||
| ||||
| Re: How to Send and Receive Cookies in ASP?
If you want to read all the cookies, then you can check the following example : Suppose the following are sent to the user by the server : Code: <%
Response.Cookies("Continent")="Asia"
Response.Cookies("user")("subcontinent")="China"
Response.Cookies("user")("country")="China"
Response.Cookies("user")("years")="25"
%> HTML Code: <html> <body> <% dim x,y for each x in Request.Cookies response.write("<p>") if Request.Cookies(x).HasKeys then for each y in Request.Cookies(x) response.write(x & ":" & y & "=" & Request.Cookies(x)(y)) response.write("<br />") next else Response.Write(x & "=" & Request.Cookies(x) & "<br />") end if response.write "</p>" next %> </body> </html>
__________________ Grand Theft Auto 4 PC Video Game |
|
#6
| ||||
| ||||
| Re: How to Send and Receive Cookies in ASP?
I wold to tell you that, you can also add the parameters to a URL in ASP. You can use the below code for adding the parameters to URL : Code: <a href="addpara.asp?fname=Miyu&lname=Juin">Go to Add Parameters Page</a> Code: <%
fname=Request.querystring("fname")
lname=Request.querystring("lname")
response.write("<p>Welcome " & fname & " " & lname & "!</p>")
response.write("<p>This is my Web site!</p>")
%> |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to Send and Receive Cookies in ASP?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Internet explorer 9 displays Cookies error message” IE9 works better when it is cookies enabled, please enable cookies” | Bellare | Technology & Internet | 10 | 07-03-2012 08:41 AM |
| Can't send SMS in Nokia C7 but can receive. | Ryder Allen | Portable Devices | 8 | 29-11-2011 03:46 PM |
| Cannot send or receive SMS on Nokia N8 | affection | Portable Devices | 3 | 15-02-2011 06:11 AM |
| Troubleshooting error messages that receive while trying to send and receive mail in Outlook | hatred | Windows Software | 5 | 20-03-2010 05:44 AM |
| Can not send or receive email | CaspaR | Windows Vista Mail | 4 | 16-05-2007 05:40 AM |