|
| |||||||||
| Tags: asp, asp sessions, cookies, java, receive, send |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| How to Send and Receive Cookies in ASP?
Hi friends, 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 |
| Not able to send or receive MMS on NOKIA X3-02 | Eliasz | Portable Devices | 6 | 18-05-2011 01:19 PM |
| I can receive e-mail, but can't send. | BJKBMN | Windows Vista Mail | 6 | 22-01-2011 09:52 PM |
| Troubleshooting error messages that receive while trying to send and receive mail in Outlook | hatred | Windows Software | 5 | 20-03-2010 06:44 AM |
| Can send email but cannot receive | Broot | Technology & Internet | 6 | 02-03-2009 10:31 PM |
| can't send email but can receive them | sandra4 | Windows Vista Mail | 3 | 10-10-2008 12:01 PM |