473,586 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cookie problem, virtual directory related

The following script sets,resets or displays the contents of a cookie.

When I place the script in a directory under the iis root, let's
say "mysite" (http://localhost/mysite/tst.asp) it works as expected.

When I create a virtual directory "mysite" and point it to the directory
where the script is, the cookie can no longer be set after it has been
cleared, even though it is accessed in the same location
(http://localhost/mysite/tst.asp)

Anyone know why?

<%

' save this code in tst.asp

If Request("mode") ="display" Then
Response.Write "cookie=" & request.cookies ("cookie") & "<br><br>"
End If

If Request("mode") ="set" Then
Response.Cookie s("cookie") = "12345"
Response.Cookie s("cookie").Exp ires = DateAdd("d", 2, Date)
Response.Cookie s("cookie").Pat h = "/"
End If

If Request("mode") ="clear" Then
Response.Cookie s("cookie") = ""
End If
%>

<a href="tst.asp?m ode=display">di splay cookie</a><br>
<a href="tst.asp?m ode=set">set cookie</a><br>
<a href="tst.asp?m ode=clear">clea r cookie</a>

<%
' end
%>
Jul 19 '05 #1
0 1839

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1537
by: Jaakko T Oksa | last post by:
suppose i have a script which sets a cookie in this manner: Response.Cookies("session_id") = '12345' Response.Cookies("session_id").Expires = <future date here> Response.Cookies("session_id").Path = "/" and another script which clears it like this Response.Cookies("session_id") = ""
3
1540
by: davidw | last post by:
Hi, I have my webdav code, I am using cookie to verify user, so user login to our website first, like http://site, then they can open link http://site/webfiles and check "open as web folder", in my code, I will check cookie under http://site and control the user's permission. It worked fine, but recently, I found when user open...
28
5194
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I...
7
2383
by: Jaydeep | last post by:
Hi, Anybody knows how to create virtual directory programmatically under root directory ofcourse from code-behind. I am developing web-based application where I need to create a folder and making this folder as virtual directory in IIS. I know in ASP how to do it. Set objIIS = GetObject("IIS://localhost/W3SVC/1/Root")...
7
7769
by: Doug | last post by:
An ASP.NET session cookie set on "www.mydomain.com" can not be accessed on "search.mydomain.com"; hence, a new session and cookie are being created on every sub-domain. This is occuring because ASP.NET always sets the Session cookie domain to the full domain (e.g. "www.mydomain.com") instead of the parent domain (e.g. "mydomain.com") The...
2
2147
by: tshad | last post by:
I am trying to use my IIS web server on my local machine for testing my web site. The problem is that periodically it will not use the virtual directory for the root. This happens for my logon page, for instance. If I have the following Virtual Directory: Staff.
1
3062
by: fredfrog22 | last post by:
The following is an extract from a C# console application that creates a Virtual Directory on IIS 5 or 6. This code works on XP, Windows 2003 Server, Windows 2000. It does not work on Windows Vista Release Candidate 1 (IIS 7). The below line pcProps.Value = strPath;
3
1776
by: rjoseph | last post by:
Hi Guys I hope this is an easy one for you. Basically I have a page on my website that creates a javascript based cookie on the users pc. The contents of the cookie when created looks as follows: ------------------------------ DS1113008PT_ToDoItem1 My%20message%20goes%20here www.mydomain.co.uk/carsearch/usedcars/
3
2921
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I cut and paste the following code from msdn help page which it just introduces view and multiview server controls. Here is what I do: in vs studio 2005, File --New Web Site, it brings me to the dir: C:\Visual Studio 2005\WebSites\WebSite1, it creates default.aspx and default.aspx.vb and I pasted the following code into...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.