Cookies Don't Persist
I can only get one cookie (which does not persist) from the following asp script:
<script language="vbscript" runat="server">
' cookie_test.asp
' Copyright (c) 2002 by Dr. Herong Yang
' This ASP page displays all the cookies received by the server.
'
response.write("<html><body>")
' Displaying all the cookies
response.write("<b>Cookies received at this time:</b>:<br/>")
set c = request.Cookies
response.write("Cookies.Count = " & c.Count & "<br/>")
for each n in c
response.write( n & " = " & c(n) & "<br/>")
next
response.write("<b>Cookie added by the server:</b><br/>")
n = "Cookie_" & (c.Count+1)
v = "Value_" & (c.Count+1)
response.write( n & " = " & v & "<br/>")
response.cookies(n) = v
response.write("</body></html>")
</script>
Which results in:
Cookies received at this time::
Cookies.Count = 0
Cookie added by the server:
Cookie_1 = Value_1
Changing the Session.Timeout value has no effect.
View Replies
ADVERTISEMENT
i have a file *.num and when i enter the full URL to download it he give my
a 404 error !
but when i rename the *.NUM by *.TXT everything coming ok !?
so how i can tell to IIS6 to accept *.num files ?
View Replies
View Related
Below is code to display in a drop down menu some addresses. There is two things i need to do. One is to not show if there are no records but also there could be duplicate records, How do i stop duplicates occuring...
View Replies
View Related
(I'm not sure if this is the right forum for my post - my question is about vbscript, but I didn't see any vbscript forum, so here goes.)
I've created a registration page on my website which gets called from a number of links on the site - I want to capture user information before allowing them access to these sections of the site.
Once a user has registered, I want to recognise that fact when they click on any of the other links, so I'm setting a cookie. However, while it works fine in Firefox, it won't persist in IE - even across a single session.
Here's the code I'm using :
In the 'Thank you for registering' page, the very first lines on the page are :
<%
Response.Cookies("Registered") = "True"
Response.Cookies("Registered").Expires = Date + 1000
%>
Where the links that require registration appear on the site, I am building the <a href> tag as follows :
<a href=
<% if Request.Cookies("Registered") = "True" then %>
"PageX.asp"
<% else %>
"Register.asp?RequestedArea=ReportDesign"
<% end if %>
class="bodyLink">Report Design</a>
but it keeps going to the Else part - ie. it's not finding that the Registered cookie has a value of True.
View Replies
View Related
I'm working in a mysql db, and I need to submit a form and persist all the values from an sql search. I tried Code:
add_records.asp?recset=rs
rs being the recordset. Didn't seem to work.
View Replies
View Related
I dont have CDONTS support. i am using the following script. with this, even yahoo doesn't consider the email to be HTML and displays all the HTML tags and treats it as TEXT. here is the code i use! Please dont consider it abuse as i dont know how to encloase the code in TAGS!
<%
mes = ""
IsSuccess = false
sTo = Trim(Request.Form("txtTo"))
sFrom = Trim(Request.Form("txtFrom"))
sSubject = Trim(Request.Form("txtSubject"))
sMailServer = "127.0.0.1"
sBody = Trim(Request.Form("txtBody"))
if Request("__action")="TestEMail" then
TestEMail()
end if
Sub TestEMail()
Set objMail = Server.CreateObject("CDO.Message")
Set objConf = Server.CreateObject("CDO.Configuration")
Set objFields = objConf.Fields
With objFields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
With objMail
Set .Configuration = objConf
.From = sFrom
.To = sTo
.Subject = sSubject
.TextBody = sBody
End With
Err.Clear
on error resume next
objMail.Send
if len(Err.Description) = 0 then
mes = " Message sent to " + sTo
mes = mes + " EMAIL SENT SUCCESSFULLY!"
IsSuccess = true
else
mes = " " + Err.Description + " TESTS FAILED!"
end if
Set objFields = Nothing
Set objConf = Nothing
Set objMail = Nothing
End sub
Sub Alert(html)
if IsSuccess then
Response.Write "<div class='testRelults' id='testSuccessful'><span class='testResult'>Success:</span>" & html & "</div>"
else
Response.Write "<div class='testRelults' id='testFailed'><span class='testResult'>Fail:</span>" & html & "</div>"
end if
End Sub
%>
View Replies
View Related
am using a join query below to get multiple results from different related tables to form one. e.g
SELECT DISTINCT dbo.e_Wallet.subscriptions, dbo.e_Wallet.username, dbo.e_Wallet.status, dbo.e_Wallet.suspension, dbo.ewalletx_yr_registratn.email, dbo.ewalletx_yr_registratn.Fiscal_Yr, dbo.ewalletx_yr_registratn.end_date, dbo.e_walletpurse.purse
FROM dbo.e_Wallet INNER JOIN dbo.ewalletx_yr_registratn ON dbo.e_Wallet.registrationID = dbo.ewalletx_yr_registratn.registrationID AND dbo.e_Wallet.email = dbo.ewalletx_yr_registratn.email LEFT OUTER JOIN dbo.e_walletpurse ON dbo.e_Wallet.email = dbo.e_walletpurse.email AND dbo.e_Wallet.registrationID = dbo.e_walletpurse.regID
WHERE username = 'variable'
however it dosent seem to work or show any results on my asp page. What is wrong here ?
View Replies
View Related
i get data with ado i need to get a xml string from the recordset how can i get it without having to persist the recordset in a (xml) text file is there a simple way ?
View Replies
View Related
i have logically divided each .asp page in one or more "states" then i need to store somewhere information about what state has each client on each page i consider 3 ways:
store info in the DB : {page,sessionid} is the PK - in a file: which i have to read on enter to the page and write on exit the page - in the session object: storing an array on a session variable, like session("x")[1...N] each way has a pros and cons, i'm choosing the last method, but i know it consumes much memory.
View Replies
View Related
Im working on an automated email sending script which work real fine. I have to send 2 different list of email ( contact1 and contact2) of an acces database file (.mdb).
The fact is that my script work well but for some reason it only send the second list of email (contact2).
The script process the list contact1 without any error but obviously it isnt sending mail to those email.
It seems to be an easy fix mistake but i cant figure out why the first contact list isnt sending. Must be a "If then" mistake or something with the loop i think.
Heres the code: ......
View Replies
View Related
I have a formview which im using to ammed records in a DB via a gridview. When an item is selected on the gridview its details are shown in the formview. Ive wrote the update statement for the Insert button in the formviews edit mode.
If i edit a record in the formview this updates the DB, but not the gridview striaght away. I have to click on one of the select buttons on the gridview to update this. I have gridview.databind() on the click event of the insert button of the formview and on pageload, if its a callback. Code:
View Replies
View Related
i'm setting up my web new server. i see that cookies do not persist after a Server.Transfer or Response.Redirect although i do expire them the next year.
View Replies
View Related
Having trouble getting Session to persist. Have checked properties of the Virtual Directory in IIS4 manager and "Enable Session State" is checked, with time out set to 20 Mins. Have also checked the Project Properties in Interdev 6.0 and confirmed that
"Sensionless ASP Pages" is NOT checked.
When moving from one page to another within the application it starts a new session for each page : I've confirmed this both by Writing the SessionID and by adding a Variable into the On_Start of the Global.asa. Only trying to store a single digit in a Session variable.
View Replies
View Related
In my Session_OnStart in Global.asa, I am setting some cookies. One
of them, I set as follows:
dim UserID
UserID = Request.ServerVariables("LOGON_USER")
Response.Cookies("User")("ID") = UCASE(UserID)
When I immediately log the cookie value retrieved from
Request.Cookies("User")("ID") into the Windows Event Log, I get the
correct value. However, when I try to retrieve the cookie on the home
page of my application using the same code,
Request.Cookies("User")("ID"), it either cannot find the cookie or
cannot read the value. I am retrieving the cookie before all HTML
headers are written. It is my first statement on the page after
Option Explicit. I have even compared the session IDs. The SessionID
created in the Session_OnStart is the same value as the SessionID on
the home page.
I have read that the Session_OnStart only has access to the
Application, Session and Request objects. It does not explicitly say
that it does not have access to the Response object. Also, I was even
able to use Response.Write's in Global.asa to print out the values
although it looked like it had also stopped the session after I did
so. Cookies are definitely enabled on my machine. I have even tried
setting the session cookie's expiration to be persistent for a few
days to see if it was perhaps expiring before I was able to read it
but this did not work either.
Is there something preventing cookies to be created in Global.asa in
the Session_OnStart sub? Is the Response object not available???
Please let me know if anyone else has had this problem or solution.
View Replies
View Related
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be
reading in online articles?
View Replies
View Related
I m creating a cookies in my application and it work properly but i can't see the cookies where it will sotred i checked the cookies folder but i didn't find that I want to create a cookies file as the other web site create and store where other cookies will stored in Cookies folder or Temprory Internet files folder eg:1. arvind@google.co[1].txt this stored in cookies folder 2. arvind@msn[2].txt ....
View Replies
View Related
I've added a cookie and I am able to read it when using the same window but
if I load up a new window and try to access it, it can't find the cookie.
Any one know why?
View Replies
View Related
I am creating a user tracking app that tracks a user one of two ways...
1)First Method is cookies
2)Second Method MS SQL DB
I first check if the users browser accepts cookies if not I go to the db. If the user accepts cookies then I check for a specific crumb if it does not have the value I am looking for I kill it and rewrite it. This is working fine (im in the middle of testing it). The problem is I decieded to test the script with NN7 and not turn cookies off but block cookies from my site and all fell apart. The condition that I have set (detect if cookies are enabled) does not stop the script from trying to set a Session Variable because the browser accepts cookies and to keep a long story short it goes into an infinite loop because the script is looking for a Session value and Its not being stopped becaues the script thinks its alright to write cookies! Is there a way to detect if a user has your sites cookies blocked? This is important because Server.CreateObject("MSWC.BrowserType") will return .Cookies = True and you will not know that your script is not executing properly because a user has your sites cookies blocked but excepts them elsewhere...
View Replies
View Related
After a login we have a menu from where we have access to different operations such as add ,delete,update.. but if a user enters the appropriate URL he has access to these operations with out proper authorization.how do we solve this.
should we use cookies,if so how exactly?
View Replies
View Related
I've built a website which requires a user to log-in to access the site. I have already built a page that enters their details into a db (register.asp), and another page where the user enters their email address (the log-in ID) to actually log-in (login.asp).
How can I use a cookie to automatically log a user in??
More specifically, what are the commands to set a cookie (upon successful registration) and access it (upon re-logging in)?
View Replies
View Related
Hey i've spent the last few hours trying to work this problem out about cookies.
When a user logs in to the site the login.asp page checks the database to see the personal page that the user re directs to e.g if bob brown logged in he would be redirected to bob.brown.asp. This is stored in a field in the database table along with the username and password.
i would like to put a cookie onto the users computer that remembers the url they were redirected to so when they press the main page button it would look for the cookie and see what url they are meant to be redirected to and take them there
My current login system is this ....
View Replies
View Related
I'm trying to load up a page through my asp page and get the cookie from that page so that I can use it later on when it needs to have it to access other parts of the site.
Basically the asp page is going to act like a browser and store the cookie from the other site, then send that cookie back when the asp page goes back to the other site again.
The problem is, I can only seem to access my own cookie. I didn't run into this problem when I was doing a similar thing inside my .cs scripts that were run by the server, as I suppose they were not coming from the actual domain that my page is running on (and thus, wasn't getting everything trampled by local cookies).
Is this possible, or should I just give up on it now?
View Replies
View Related
im building a site for a few doctors surgeries. the user is able to see what appointments are available and then book that date/time. i have a table (in my db) of dates/times and a checkbox to say whether the time has been booked or not (and display only times that havnt been booked). i was going to have the user add the time to a "cart" and then check the "booked" checkbox in my db when theyve paid for that appointment. but if i have lots of people looking at the site at the same time, then they may be able to see times that are just about to be booked. i think a better way is to have the date/time stuffed into a cookie which expires after 5 minutes. so when a user adds a time to their "cart", it will say something like: "this time will expire in 5 minutes until you book it or re-add it to your cart". does that make sense?
how can i do this with server-cide cookies (im using jscript)? can anyone think of a better way to do this?
View Replies
View Related
trying to delete a cookie, without success it seems. The following code
to delete and check a cookie produces "yes" where I expected "no"
Anyone tell me how to delete a cookie if this code is wrong.
response.cookies("savedforum").expires = date - 1
if request.cookies("savedforum").haskeys then
response.write "yes"
else
response.write "no"
View Replies
View Related
I have the code below which I know it is wrong where the cookies come in. I am trying to write the values collected from a database into cookies. However I am having difficulty trying to figure out how to write rows of cookies with different values. This may be a little difficult to explain - see the following code:
View Replies
View Related
I need to set a cookie on a user after they have logged in. I want to
use just the user's login name , since that is a unique field.
If rsPersonIDCheck.EOF Then
Session("blnValidUser") = False
Else
Session("login") = rsPersonIDCheck("login")
but:
set Cookies("User") = Session("login")
seems not to be creating the cookie
View Replies
View Related
I know little abt asp.I have done aproject on asp but I don't know much on cookies.if u know then plz give me idea with some codes.
View Replies
View Related
Not strictly a full asp question but Im sure someone here will have the
answer.I've read in several web sites that you can read and write to the same
cookie with asp and javascript.Does anyone have any sample coding showing how to do this with the javascript along with the asp code or were these websites I saw it mentioned
on bogus?
View Replies
View Related
In my web application i'm are able to store large data in
the browser cookie keeping in mind the limit of 300
cookies per browser, 20 keys per cookie per domain and 4KB
max size of each cookie. i'm are unable to retreive this
large amount of data immediately after storing through
document.cookie in IE browser (The same works fine in
Netscape).
Is there any limit on the size of the data that can be
retreived using document.cookie? Could you please suggest
a solution to this problem i'm are facing.
View Replies
View Related
If I Request.Cookies("cookiename") and the cookie doesnt exist could I use
If Request.Cookies("cookiename") = "" Then
Display Error Message
End If
or would i use
If Request.Cookies("cookiename") = Nothing Then
Display Error Message
End If
View Replies
View Related
I found that a number of my sites that send email using CDO failed withing the past 30 days. Consider the following. I know its not the best coding practice to open and close the connection so many times but Im curious why this would all of a sudden become an issue.
1. Have a few large sites essentially all variables such as SMTP server are set using cookies so I can deploy multiple sites quickly.
2. Within the site email appears to work correctly across all pages with 1 exception.
3. The exception is below, Im wondering if it has to do with cookies having to be retrieved multiple times from the client machine
--Call db run search loop data build array
--Based on data in array call another search alter and finalize array
--Do while <= uBound(myArray)
--Call Email sub (from,to,sub,body) ' Sub contains a request cookies for SMTP server.
--Loop
Doesnt matter if its 2 or 50 emails always fails when using request.cookies to set the SMTP in the sub. Works fine if I hard code the IP. This same sub is used multiple times throughout the website and works fine with cookies.
Just curious why it needs might need to be hard coded in the loop. Has been running for about 6 months fine and have recently started noticing failures.
View Replies
View Related
All the cookies that i have don't show any bad cookies as i call them but only show the cookies that they want on the users computer but for some reason i am getting lots of bad cookies from my website at http://tmd-1.com/ and i don't know how to stop the bad cookies from downloading to the computer the cookies i am having trouble with will be in a red box in the image below.....
View Replies
View Related
I started using the following code, although, I have a feeling it is not working. Also, do I have to place the same code on all accessed pages? Code:
<%
Response.Cookies("ExpCookie") = "Expiration"
Response.Cookies("ExpCookie").Expires = DateAdd("d", 1, Now())
Response.Cookies("ExpCookie").Secure = True
Response.Cookies("LastVisit") = Date & " " & Time
%>
I am new at all of this, I can understand that this cookie will expire an hour after being access on a given day (is that right?), and it will create the cookie with the printed date and time of access. how can I make sure cookie expire on time.
View Replies
View Related