Hello all,
I'm still a bit new with JavaScript, and I hope the guru here can shed
some light for me. It's regarding handling cookie and the
case-sensitive nature of JavaScript itself.
My problem is how do I handle the "path" parameter in cookie.
First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
that page.
Then, the following page, somehow change the case on the path, such as http://www.testServer1.com/testApp/page2.htm. Now in this page, I
cannot access to the cookie that's set at the first initial page.
Is there anyway to handle this kind of scenario? I hope I'm explaining
the problem correctly.
Thank you in advance.
Kelvin 6 2700
Why does the TestApp directory have to change caps?
kelvlam wrote:
Hello all,
I'm still a bit new with JavaScript, and I hope the guru here can shed
some light for me. It's regarding handling cookie and the
case-sensitive nature of JavaScript itself.
My problem is how do I handle the "path" parameter in cookie.
First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
that page.
Then, the following page, somehow change the case on the path, such as http://www.testServer1.com/testApp/page2.htm. Now in this page, I
cannot access to the cookie that's set at the first initial page.
Is there anyway to handle this kind of scenario? I hope I'm explaining
the problem correctly.
Thank you in advance.
Kelvin
kelvlam said the following on 8/21/2006 2:20 PM:
Hello all,
I'm still a bit new with JavaScript, and I hope the guru here can shed
some light for me. It's regarding handling cookie and the
case-sensitive nature of JavaScript itself.
My problem is how do I handle the "path" parameter in cookie.
First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
that page.
Then, the following page, somehow change the case on the path, such as http://www.testServer1.com/testApp/page2.htm. Now in this page, I
cannot access to the cookie that's set at the first initial page.
Is there anyway to handle this kind of scenario? I hope I'm explaining
the problem correctly.
Set it to lower case, then test it.
cookieString.to LowerCase()
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Randy Webb wrote:
kelvlam said the following on 8/21/2006 2:20 PM:
Hello all,
I'm still a bit new with JavaScript, and I hope the guru here can shed
some light for me. It's regarding handling cookie and the
case-sensitive nature of JavaScript itself.
My problem is how do I handle the "path" parameter in cookie.
First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
that page.
Then, the following page, somehow change the case on the path, such as http://www.testServer1.com/testApp/page2.htm. Now in this page, I
cannot access to the cookie that's set at the first initial page.
Is there anyway to handle this kind of scenario? I hope I'm explaining
the problem correctly.
Set it to lower case, then test it.
cookieString.to LowerCase()
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
So should I be doing toLowercase both when setting and getting?
i.e. document.cookie = cookieStr.toLow erCase();
and for my get, I should just set the search parameter to
param.toLowerCa se() and then do the string comparison?
I want to elaborate a little bit more of why I'm asking this question
also, and give some precious description of my problem.
The problem is I have no control of how a client browser access my web
site. They could be coming in as "http://www.testAbc.com/site1", or
they can be coming in as "http://www.testAbc.com/SiTe1". The site's
Index.htm page then redirect the incoming request, to a internal ISAPI
call on the IIS server.
For example when a client come in from the browser as
"http://www.testAbc.com/SiTe1", all cookies created will be only be
accessible for pages that contain "http://www.testAbc.com/SiTe1" in the
window.location property, correct? Since all my pages are generated
dynamically by the ISAPI DLL, the window.location property could be
change without my notice... and if the page somehow got
"http://www.testAbc.com/site1" stored in the window.location property,
then I won't be able to access the cookie that I intended to.
Sorry for my very broken English. It's really hard to try to explain
technical detail when I have still a fairly limited understanding of
JavaScript. I hope I didn't confuse the original problem...
Much appreciate for the help in advance.
--
Kelvin
kelvlam wrote:
Randy Webb wrote:
kelvlam said the following on 8/21/2006 2:20 PM:
Hello all,
>
I'm still a bit new with JavaScript, and I hope the guru here can shed
some light for me. It's regarding handling cookie and the
case-sensitive nature of JavaScript itself.
>
My problem is how do I handle the "path" parameter in cookie.
>
First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
that page.
>
Then, the following page, somehow change the case on the path, such as http://www.testServer1.com/testApp/page2.htm. Now in this page, I
cannot access to the cookie that's set at the first initial page.
>
Is there anyway to handle this kind of scenario? I hope I'm explaining
the problem correctly.
Set it to lower case, then test it.
cookieString.to LowerCase()
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
So should I be doing toLowercase both when setting and getting?
i.e. document.cookie = cookieStr.toLow erCase();
and for my get, I should just set the search parameter to
param.toLowerCa se() and then do the string comparison?
I want to elaborate a little bit more of why I'm asking this question
also, and give some precious description of my problem.
The problem is I have no control of how a client browser access my web
site. They could be coming in as "http://www.testAbc.com/site1", or
they can be coming in as "http://www.testAbc.com/SiTe1". The site's
Index.htm page then redirect the incoming request, to a internal ISAPI
call on the IIS server.
For example when a client come in from the browser as
"http://www.testAbc.com/SiTe1", all cookies created will be only be
accessible for pages that contain "http://www.testAbc.com/SiTe1" in the
window.location property, correct? Since all my pages are generated
dynamically by the ISAPI DLL, the window.location property could be
change without my notice... and if the page somehow got
"http://www.testAbc.com/site1" stored in the window.location property,
then I won't be able to access the cookie that I intended to.
Sorry for my very broken English. It's really hard to try to explain
technical detail when I have still a fairly limited understanding of
JavaScript. I hope I didn't confuse the original problem...
Much appreciate for the help in advance.
--
Kelvin
I would like to point out, I've been using these common utilities
function as well, for handling my cookie within the pages. Maybe I can
tweak these utility functions to solve my problem?
<pre>
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
* [expires] Expiration date of the cookie (default: end of current
session)
* [path] Path where the cookie is valid (default: path of calling
document)
* [domain] Domain where the cookie is valid (default: domain of
calling document)
* [secure] Boolean value indicating if the cookie transmission
requires a secure transmission
*/
function setCookie(name, value, expires, path, domain, secure) {
var cookieStr;
cookieStr = name + "=" + escape(value);
cookieStr += ((expires) ? "; expires=" + expires.toGMTSt ring() : "");
cookieStr += ((path) ? "; path=" + path : "");
cookieStr += ((domain) ? "; domain=" + domain : "");
cookieStr += ((secure) ? "; secure" : "");
document.cookie = cookieStr;
}
/**
* Gets the value of the specified cookie.
*
* name Name of the desired cookie.
*
* Returns a string containing value of specified cookie,
* or null if cookie does not exist.
*/
function getCookie(name) {
var dc = document.cookie ;
var prefix = name.toLowerCas e() + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(pref ix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie .indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.sub string(begin + prefix.length, end));
}
/**
* Deletes the specified cookie.
*
* name name of the cookie
* [path] path of the cookie (must be same as path used to create
cookie)
* [domain] domain of the cookie (must be same as domain used to create
cookie)
*/
function deleteCookie(na me, path, domain) {
if (getCookie(name )) {
var cookieStr;
cookieStr = name.toLowerCas e() + "=";
cookieStr += ((path) ? "; path=" + path : ""); //defaultPath);
cookieStr += ((domain) ? "; domain=" + domain : "");
cookieStr += "; expires=Thu, 01-Jan-70 00:00:01 GMT";
document.cookie = cookieStr;
}
}
</pre>
Good info. I will be in touch.
kelvlam wrote:
kelvlam wrote:
Randy Webb wrote:
kelvlam said the following on 8/21/2006 2:20 PM:
Hello all,
I'm still a bit new with JavaScript, and I hope the guru here can shed
some light for me. It's regarding handling cookie and the
case-sensitive nature of JavaScript itself.
My problem is how do I handle the "path" parameter in cookie.
First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
that page.
Then, the following page, somehow change the case on the path, such as http://www.testServer1.com/testApp/page2.htm. Now in this page, I
cannot access to the cookie that's set at the first initial page.
Is there anyway to handle this kind of scenario? I hope I'm explaining
the problem correctly.
>
Set it to lower case, then test it.
>
cookieString.to LowerCase()
>
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
So should I be doing toLowercase both when setting and getting?
i.e. document.cookie = cookieStr.toLow erCase();
and for my get, I should just set the search parameter to
param.toLowerCa se() and then do the string comparison?
I want to elaborate a little bit more of why I'm asking this question
also, and give some precious description of my problem.
The problem is I have no control of how a client browser access my web
site. They could be coming in as "http://www.testAbc.com/site1", or
they can be coming in as "http://www.testAbc.com/SiTe1". The site's
Index.htm page then redirect the incoming request, to a internal ISAPI
call on the IIS server.
For example when a client come in from the browser as
"http://www.testAbc.com/SiTe1", all cookies created will be only be
accessible for pages that contain "http://www.testAbc.com/SiTe1" in the
window.location property, correct? Since all my pages are generated
dynamically by the ISAPI DLL, the window.location property could be
change without my notice... and if the page somehow got
"http://www.testAbc.com/site1" stored in the window.location property,
then I won't be able to access the cookie that I intended to.
Sorry for my very broken English. It's really hard to try to explain
technical detail when I have still a fairly limited understanding of
JavaScript. I hope I didn't confuse the original problem...
Much appreciate for the help in advance.
--
Kelvin
I would like to point out, I've been using these common utilities
function as well, for handling my cookie within the pages. Maybe I can
tweak these utility functions to solve my problem?
<pre>
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
* [expires] Expiration date of the cookie (default: end of current
session)
* [path] Path where the cookie is valid (default: path of calling
document)
* [domain] Domain where the cookie is valid (default: domain of
calling document)
* [secure] Boolean value indicating if the cookie transmission
requires a secure transmission
*/
function setCookie(name, value, expires, path, domain, secure) {
var cookieStr;
cookieStr = name + "=" + escape(value);
cookieStr += ((expires) ? "; expires=" + expires.toGMTSt ring() : "");
cookieStr += ((path) ? "; path=" + path : "");
cookieStr += ((domain) ? "; domain=" + domain : "");
cookieStr += ((secure) ? "; secure" : "");
document.cookie = cookieStr;
}
/**
* Gets the value of the specified cookie.
*
* name Name of the desired cookie.
*
* Returns a string containing value of specified cookie,
* or null if cookie does not exist.
*/
function getCookie(name) {
var dc = document.cookie ;
var prefix = name.toLowerCas e() + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(pref ix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie .indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.sub string(begin + prefix.length, end));
}
/**
* Deletes the specified cookie.
*
* name name of the cookie
* [path] path of the cookie (must be same as path used to create
cookie)
* [domain] domain of the cookie (must be same as domain used to create
cookie)
*/
function deleteCookie(na me, path, domain) {
if (getCookie(name )) {
var cookieStr;
cookieStr = name.toLowerCas e() + "=";
cookieStr += ((path) ? "; path=" + path : ""); //defaultPath);
cookieStr += ((domain) ? "; domain=" + domain : "");
cookieStr += "; expires=Thu, 01-Jan-70 00:00:01 GMT";
document.cookie = cookieStr;
}
}
</pre>
kelvlam wrote:
kelvlam wrote:
Randy Webb wrote:
kelvlam said the following on 8/21/2006 2:20 PM:
Hello all,
I'm still a bit new with JavaScript, and I hope the guru here can shed
some light for me. It's regarding handling cookie and the
case-sensitive nature of JavaScript itself.
My problem is how do I handle the "path" parameter in cookie.
First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
that page.
Then, the following page, somehow change the case on the path, such as http://www.testServer1.com/testApp/page2.htm. Now in this page, I
cannot access to the cookie that's set at the first initial page.
Is there anyway to handle this kind of scenario? I hope I'm explaining
the problem correctly.
>
Set it to lower case, then test it.
>
cookieString.to LowerCase()
>
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
So should I be doing toLowercase both when setting and getting?
i.e. document.cookie = cookieStr.toLow erCase();
and for my get, I should just set the search parameter to
param.toLowerCa se() and then do the string comparison?
I want to elaborate a little bit more of why I'm asking this question
also, and give some precious description of my problem.
The problem is I have no control of how a client browser access my web
site. They could be coming in as "http://www.testAbc.com/site1", or
they can be coming in as "http://www.testAbc.com/SiTe1". The site's
Index.htm page then redirect the incoming request, to a internal ISAPI
call on the IIS server.
For example when a client come in from the browser as
"http://www.testAbc.com/SiTe1", all cookies created will be only be
accessible for pages that contain "http://www.testAbc.com/SiTe1" in the
window.location property, correct? Since all my pages are generated
dynamically by the ISAPI DLL, the window.location property could be
change without my notice... and if the page somehow got
"http://www.testAbc.com/site1" stored in the window.location property,
then I won't be able to access the cookie that I intended to.
Sorry for my very broken English. It's really hard to try to explain
technical detail when I have still a fairly limited understanding of
JavaScript. I hope I didn't confuse the original problem...
Much appreciate for the help in advance.
--
Kelvin
I would like to point out, I've been using these common utilities
function as well, for handling my cookie within the pages. Maybe I can
tweak these utility functions to solve my problem?
<pre>
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
* [expires] Expiration date of the cookie (default: end of current
session)
* [path] Path where the cookie is valid (default: path of calling
document)
* [domain] Domain where the cookie is valid (default: domain of
calling document)
* [secure] Boolean value indicating if the cookie transmission
requires a secure transmission
*/
function setCookie(name, value, expires, path, domain, secure) {
var cookieStr;
cookieStr = name + "=" + escape(value);
cookieStr += ((expires) ? "; expires=" + expires.toGMTSt ring() : "");
cookieStr += ((path) ? "; path=" + path : "");
cookieStr += ((domain) ? "; domain=" + domain : "");
cookieStr += ((secure) ? "; secure" : "");
document.cookie = cookieStr;
}
/**
* Gets the value of the specified cookie.
*
* name Name of the desired cookie.
*
* Returns a string containing value of specified cookie,
* or null if cookie does not exist.
*/
function getCookie(name) {
var dc = document.cookie ;
var prefix = name.toLowerCas e() + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(pref ix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie .indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.sub string(begin + prefix.length, end));
}
/**
* Deletes the specified cookie.
*
* name name of the cookie
* [path] path of the cookie (must be same as path used to create
cookie)
* [domain] domain of the cookie (must be same as domain used to create
cookie)
*/
function deleteCookie(na me, path, domain) {
if (getCookie(name )) {
var cookieStr;
cookieStr = name.toLowerCas e() + "=";
cookieStr += ((path) ? "; path=" + path : ""); //defaultPath);
cookieStr += ((domain) ? "; domain=" + domain : "");
cookieStr += "; expires=Thu, 01-Jan-70 00:00:01 GMT";
document.cookie = cookieStr;
}
}
</pre>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: R.Wieser |
last post by:
Hello All,
I'm trying to get a "Virtual Listbox" to work. I've currently got a form,
and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and
LBS_NODATA flags on it. I've allso subclassed the window and do see all
kinds of WS_??? messages coming by.
But now I'm stuck :-\
I've got *no* idea what to do next, and all my searching on the web leads me
|
by: Tim Clacy |
last post by:
Please illuminate; what operator of class 'Event' will get matched for these
two cases :
Event ev1;
Event ev2;
// Case 1
//
if (ev1)
;
|
by: Ken Brubaker |
last post by:
I am using DB2 8.5 FP5 on Windows 2000 Server and have noticed what appears
to be a handle leak. When I execute a DB2 connect statement in a command
window, followed by a DB2 connect reset statement, The number of handles
displayed in Windows Task Manager for the db2syscs process does not return
to its original value, but to 1 handle higher.
While this is not a serious issue most of the time, we have applications
connecting every 30...
|
by: Abhi |
last post by:
FYI:
This message is for the benefit of MS Access Community. I found that
this prblem has been encounterd by many but there is hardly any place
where a complete solution is posted. So I thought I should give back
to the community by posting our findings.
Thanks you all for all your help till now by posting problems and
their solutions.
~Abhijit
|
by: Leandro Berti via DotNetMonster.com |
last post by:
Hi All,
I wrote a code to do serial communication with an equipament.
When i use the code outside of threaded class it seens work properly,
but when i put inside a class and execute a thread in the first seconds the
communication is ok, later i receive read/write error.
I?ve been in MSDN site and there i discover that the read/write error is a
INVALID_HANDLE problem. But why??? I just create the serial communication
file and use it....
| |
by: Schorschi |
last post by:
Can't seemd to get ReadFile API to work! Returns invalid handle
error?
===========================================================================
Ok, the visual basic gurus, help!
The following is a diskette class (vb .net) that works find, in that I
can validate a diskette is mounted, dismount it, lock it, unlock it,
get diskette geometry, etc., all with a valid handle from CreateFile
API! I can even position the file pointer,...
|
by: SamSpade |
last post by:
If I have a class that inherits from, say RichTextBox and in the derived
class I refer to Handle, does it refer to the RichTextBox class or the
derived class?
I'm wondering if the derived class gets it's own handle or is there only one
for both classes (after all there is only one window)?
Thanks
|
by: Gary Wessle |
last post by:
Hi
I need help organizing this program in the right way.
I included the code below which compiles and runs and gives the
desired effect to a certain point, but I don't know what the next step
is to finish this program.
the program presents Main menu to the user and gives a prompt, the
user types the number corresponding to an item from the menu, the
program then
|
by: Liming |
last post by:
Hi,
In a typical 3 tier model (view layer, busines layer and data access
layer) where do you handle your exceptions? do you let it buble up all
the way to the .aspx pages or do you handle it in your business layer
and/or data access layer?
suppose in my data access layer, I provide try and catch, log the
exception and re-throw it back to business layer, then in yoru business
layer, what do you do? throw it back to the code behind or...
|
by: weaknessforcats |
last post by:
Handle Classes
Handle classes, also called Envelope or Cheshire Cat classes, are part of the Bridge design pattern. The objective of the Bridge pattern is to separate the abstraction from the implementation so the two can vary independently.
Handle classes usually contain a pointer to the object implementation. The Handle object is used rather than the implemented object. This leaves the implemented object free to change without affecting...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |