473,465 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cookie munging problem

Hi,

I'm trying to use the cookie munging session handling behaviour of asp.net
instead of cookies themselves as I'm finding quite a few people are barring
cookies (especially AOL users). If I change the setting in web.config
everything seems to work fine as long as I'm using relative paths. The
problem is I've got a menuing system that's generated from a site-wide
template - so I use a fixed path from the application root - (ie:
/application/sub-dir/page.aspx) because I don't actually know where the
user is at any given moment because it's a site-wide menu.

Whenever someone clicks on one of them, the Session ID gets wiped from the
URL and the user gets logged out. Am I missing something really stupid
here? How can I persist the SessionID in these URLs?

Cheers

Chris
Nov 17 '05 #1
5 3017
I had the same problem and wound up changing the menu system so that my
navigation is in 4 different controls vs. one. Each control is located in a
position so that it can use relative paths with respect to the page. Instead
of making a change in one nav control I have to make it in 4 but it is still
worth it in order to use cookie munging. My users refuse to allow cookies.
Hope your post results in a better option , I'd love to get back to using
one nav control vs 4.
<ch***@yahoo.com> wrote in message
news:ex*************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the cookie munging session handling behaviour of asp.net
instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I change the setting in web.config
everything seems to work fine as long as I'm using relative paths. The
problem is I've got a menuing system that's generated from a site-wide
template - so I use a fixed path from the application root - (ie:
/application/sub-dir/page.aspx) because I don't actually know where the
user is at any given moment because it's a site-wide menu.

Whenever someone clicks on one of them, the Session ID gets wiped from the
URL and the user gets logged out. Am I missing something really stupid
here? How can I persist the SessionID in these URLs?

Cheers

Chris

Nov 17 '05 #2
Well that looks interesting. All of my navigation links are generated using
the asp server side controls. Hadn't thought of using the code behind to set
up the urls though. Can you give me a bit of help in getting started on
this? For example if I have the following:

Root
default.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA
PageA.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA/subfolderB
PageAB.aspx consisting of 1 nav user control nav.ascx
Right now I would have to code each user control seperately based on their
relative position in the web even though each nav.ascx displays all the
files the user needs to get to. (of course the premise is that I wish to
continue to use cookie munging.) This is because each user control is
relative depending on the aspx page that calls it vs where it (the ascx)
actually exists.

If I understand your suggestion correctly you are saying that I could keep
one (my root for example) nav.ascx and use it from any aspx page within the
heirarchy by referencing the session.sessionid in the nav.ascx code behind?I
f that is true it would certainly solve the problem.

Can you give me a simple (I'm not very bright) example of the code for the
code behind and the ascx code for a couple of levels (maybe using the folder
structure I mentioned earlier)? Actually just one would probably do me. For
example how would I reference the session.sessionid in the code behind and
then retrieve that in the asp hyperlink?

Thanks in advance.


<ch***@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
Hi Seaside,

I think I've figured out how to do it. May or may not work for you. My menu is an asp.net menu created server side, so i've basically changed the base
url (ie: "/site/") to "/site/(sjkfj23jsdfjlsdkfj)/" note - the sjkfj23.... etc. is referenced in code behind using session.sessionID

If your menu is generated server side, then this will work for you. If it's just a client-side menu that you don't generate in code, then it won't.

Hope that helps???

Chris

"Seaside" <ss@hotmail.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
I had the same problem and wound up changing the menu system so that my
navigation is in 4 different controls vs. one. Each control is located in
a
position so that it can use relative paths with respect to the page.

Instead
of making a change in one nav control I have to make it in 4 but it is

still
worth it in order to use cookie munging. My users refuse to allow cookies. Hope your post results in a better option , I'd love to get back to using one nav control vs 4.
<ch***@yahoo.com> wrote in message
news:ex*************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to use the cookie munging session handling behaviour of

asp.net instead of cookies themselves as I'm finding quite a few people are

barring
cookies (especially AOL users). If I change the setting in web.config
everything seems to work fine as long as I'm using relative paths. The problem is I've got a menuing system that's generated from a site-wide
template - so I use a fixed path from the application root - (ie:
/application/sub-dir/page.aspx) because I don't actually know where the user is at any given moment because it's a site-wide menu.

Whenever someone clicks on one of them, the Session ID gets wiped from the URL and the user gets logged out. Am I missing something really stupid here? How can I persist the SessionID in these URLs?

Cheers

Chris



Nov 17 '05 #3
Sure, it's simple.

Basically, use only one nav.ascx.

When you set up the urls, do so server side using absolute links instead of
relative.

So for example, let's assume your application is called MyApp and it's in a
virtualdirectory called MyApp.

It's root directory looks like:

default.aspx
subfolderA/page1.aspx
subfolderB/page2.aspx

All 3 pages have the same nav.ascx control.

The URLs would have to be generated server side, so you'd have to do
something like (assuming nav.ascx code behind is a class called nav):

nav.HomeURL = "/MyApp/(" + session.sessionID + ")/Default.aspx"
nav.Page1URL = "/MyApp/(" + session.sessionID + ")/subfolderA/page1.aspx"
nav.Page2URL = "/MyApp/(" + session.sessionID + ")/subfolderB/page2.aspx"

This definately does work - as i've got it working on my site. Now the only
problem is if the user leaves the site (like to go to a credit card
processing page hosted elsewhere) and comes back - you need to persist the
sessionID somehow....

Hope that helps

Chris

"Seaside" <ss@hotmail.com> wrote in message
news:eY****************@tk2msftngp13.phx.gbl...
Well that looks interesting. All of my navigation links are generated using the asp server side controls. Hadn't thought of using the code behind to set up the urls though. Can you give me a bit of help in getting started on
this? For example if I have the following:

Root
default.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA
PageA.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA/subfolderB
PageAB.aspx consisting of 1 nav user control nav.ascx
Right now I would have to code each user control seperately based on their
relative position in the web even though each nav.ascx displays all the
files the user needs to get to. (of course the premise is that I wish to
continue to use cookie munging.) This is because each user control is
relative depending on the aspx page that calls it vs where it (the ascx)
actually exists.

If I understand your suggestion correctly you are saying that I could keep
one (my root for example) nav.ascx and use it from any aspx page within the heirarchy by referencing the session.sessionid in the nav.ascx code behind?I f that is true it would certainly solve the problem.

Can you give me a simple (I'm not very bright) example of the code for the
code behind and the ascx code for a couple of levels (maybe using the folder structure I mentioned earlier)? Actually just one would probably do me. For example how would I reference the session.sessionid in the code behind and
then retrieve that in the asp hyperlink?

Thanks in advance.


<ch***@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
Hi Seaside,

I think I've figured out how to do it. May or may not work for you. My

menu
is an asp.net menu created server side, so i've basically changed the base
url (ie: "/site/") to "/site/(sjkfj23jsdfjlsdkfj)/" note - the

sjkfj23....
etc. is referenced in code behind using session.sessionID

If your menu is generated server side, then this will work for you. If

it's
just a client-side menu that you don't generate in code, then it won't.

Hope that helps???

Chris

"Seaside" <ss@hotmail.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
I had the same problem and wound up changing the menu system so that my navigation is in 4 different controls vs. one. Each control is located in
a
position so that it can use relative paths with respect to the page.

Instead
of making a change in one nav control I have to make it in 4 but it is

still
worth it in order to use cookie munging. My users refuse to allow

cookies. Hope your post results in a better option , I'd love to get back to using one nav control vs 4.
<ch***@yahoo.com> wrote in message
news:ex*************@tk2msftngp13.phx.gbl...
> Hi,
>
> I'm trying to use the cookie munging session handling behaviour of

asp.net
> instead of cookies themselves as I'm finding quite a few people are
barring
> cookies (especially AOL users). If I change the setting in web.config > everything seems to work fine as long as I'm using relative paths. The > problem is I've got a menuing system that's generated from a site-wide > template - so I use a fixed path from the application root - (ie:
> /application/sub-dir/page.aspx) because I don't actually know where the > user is at any given moment because it's a site-wide menu.
>
> Whenever someone clicks on one of them, the Session ID gets wiped
from the
> URL and the user gets logged out. Am I missing something really

stupid > here? How can I persist the SessionID in these URLs?
>
> Cheers
>
> Chris
>
>



Nov 17 '05 #4
Super! Thanks bunches!
<ch***@yahoo.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
Sure, it's simple.

Basically, use only one nav.ascx.

When you set up the urls, do so server side using absolute links instead of relative.

So for example, let's assume your application is called MyApp and it's in a virtualdirectory called MyApp.

It's root directory looks like:

default.aspx
subfolderA/page1.aspx
subfolderB/page2.aspx

All 3 pages have the same nav.ascx control.

The URLs would have to be generated server side, so you'd have to do
something like (assuming nav.ascx code behind is a class called nav):

nav.HomeURL = "/MyApp/(" + session.sessionID + ")/Default.aspx"
nav.Page1URL = "/MyApp/(" + session.sessionID + ")/subfolderA/page1.aspx"
nav.Page2URL = "/MyApp/(" + session.sessionID + ")/subfolderB/page2.aspx"

This definately does work - as i've got it working on my site. Now the only problem is if the user leaves the site (like to go to a credit card
processing page hosted elsewhere) and comes back - you need to persist the
sessionID somehow....

Hope that helps

Chris

"Seaside" <ss@hotmail.com> wrote in message
news:eY****************@tk2msftngp13.phx.gbl...
Well that looks interesting. All of my navigation links are generated

using
the asp server side controls. Hadn't thought of using the code behind to

set
up the urls though. Can you give me a bit of help in getting started on
this? For example if I have the following:

Root
default.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA
PageA.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA/subfolderB
PageAB.aspx consisting of 1 nav user control nav.ascx
Right now I would have to code each user control seperately based on their
relative position in the web even though each nav.ascx displays all the
files the user needs to get to. (of course the premise is that I wish to
continue to use cookie munging.) This is because each user control is
relative depending on the aspx page that calls it vs where it (the ascx)
actually exists.

If I understand your suggestion correctly you are saying that I could keep one (my root for example) nav.ascx and use it from any aspx page within

the
heirarchy by referencing the session.sessionid in the nav.ascx code

behind?I
f that is true it would certainly solve the problem.

Can you give me a simple (I'm not very bright) example of the code for the code behind and the ascx code for a couple of levels (maybe using the

folder
structure I mentioned earlier)? Actually just one would probably do me.

For
example how would I reference the session.sessionid in the code behind and then retrieve that in the asp hyperlink?

Thanks in advance.


<ch***@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
Hi Seaside,

I think I've figured out how to do it. May or may not work for you. My
menu
is an asp.net menu created server side, so i've basically changed the base url (ie: "/site/") to "/site/(sjkfj23jsdfjlsdkfj)/" note - the

sjkfj23....
etc. is referenced in code behind using session.sessionID

If your menu is generated server side, then this will work for you.
If it's
just a client-side menu that you don't generate in code, then it
won't.
Hope that helps???

Chris

"Seaside" <ss@hotmail.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
> I had the same problem and wound up changing the menu system so that

my > navigation is in 4 different controls vs. one. Each control is located in
a
> position so that it can use relative paths with respect to the page.
Instead
> of making a change in one nav control I have to make it in 4 but it
is still
> worth it in order to use cookie munging. My users refuse to allow

cookies.
> Hope your post results in a better option , I'd love to get back to

using
> one nav control vs 4.
>
>
> <ch***@yahoo.com> wrote in message
> news:ex*************@tk2msftngp13.phx.gbl...
> > Hi,
> >
> > I'm trying to use the cookie munging session handling behaviour of
asp.net
> > instead of cookies themselves as I'm finding quite a few people are > barring
> > cookies (especially AOL users). If I change the setting in web.config > > everything seems to work fine as long as I'm using relative paths.

The
> > problem is I've got a menuing system that's generated from a site-wide > > template - so I use a fixed path from the application root - (ie:
> > /application/sub-dir/page.aspx) because I don't actually know
where the
> > user is at any given moment because it's a site-wide menu.
> >
> > Whenever someone clicks on one of them, the Session ID gets wiped

from the
> > URL and the user gets logged out. Am I missing something really

stupid
> > here? How can I persist the SessionID in these URLs?
> >
> > Cheers
> >
> > Chris
> >
> >
>
>



Nov 17 '05 #5
Ooops. I seem to be running into a problem. Perhaps I don't fully grasp the
technique although I appreciate the concept.
When you say
When you set up the urls, do so server side using absolute links instead of relative.
You mean using a <asp:hyperlink runat: = "server"> tag.....correct?

If so then in the NavigateUrl="" attribute of the asp:hyperlink I would
place the variable which was referenced in the code behind for that
particular URL. For example <asp:hyperlink runat: = "server"
navigateurl=nav.HomeUrl >

Is that correct?

If so then I must not be setting the reference correctly in the code behind
of the nav.ascx. Where in the code behind and how are you placing that
reference? I tried dimming a variable as a string inside the code behind
class and then assigning the absolute path as you instructed but I suspect
that I didn't do it correctly because it couldn't find the page. I can't
figure out if I'm not setting the reference correctly or I'm not using the
reference correctly in the <asp:hyperlink> tag.
Thanks again.




<ch***@yahoo.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl... Sure, it's simple.

Basically, use only one nav.ascx.

When you set up the urls, do so server side using absolute links instead of relative.

So for example, let's assume your application is called MyApp and it's in a virtualdirectory called MyApp.

It's root directory looks like:

default.aspx
subfolderA/page1.aspx
subfolderB/page2.aspx

All 3 pages have the same nav.ascx control.

The URLs would have to be generated server side, so you'd have to do
something like (assuming nav.ascx code behind is a class called nav):

nav.HomeURL = "/MyApp/(" + session.sessionID + ")/Default.aspx"
nav.Page1URL = "/MyApp/(" + session.sessionID + ")/subfolderA/page1.aspx"
nav.Page2URL = "/MyApp/(" + session.sessionID + ")/subfolderB/page2.aspx"

This definately does work - as i've got it working on my site. Now the only problem is if the user leaves the site (like to go to a credit card
processing page hosted elsewhere) and comes back - you need to persist the
sessionID somehow....

Hope that helps

Chris

"Seaside" <ss@hotmail.com> wrote in message
news:eY****************@tk2msftngp13.phx.gbl...
Well that looks interesting. All of my navigation links are generated

using
the asp server side controls. Hadn't thought of using the code behind to

set
up the urls though. Can you give me a bit of help in getting started on
this? For example if I have the following:

Root
default.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA
PageA.aspx consisting of 1 nav user control nav.ascx

Root/subfolderA/subfolderB
PageAB.aspx consisting of 1 nav user control nav.ascx
Right now I would have to code each user control seperately based on their
relative position in the web even though each nav.ascx displays all the
files the user needs to get to. (of course the premise is that I wish to
continue to use cookie munging.) This is because each user control is
relative depending on the aspx page that calls it vs where it (the ascx)
actually exists.

If I understand your suggestion correctly you are saying that I could keep one (my root for example) nav.ascx and use it from any aspx page within

the
heirarchy by referencing the session.sessionid in the nav.ascx code

behind?I
f that is true it would certainly solve the problem.

Can you give me a simple (I'm not very bright) example of the code for the code behind and the ascx code for a couple of levels (maybe using the

folder
structure I mentioned earlier)? Actually just one would probably do me.

For
example how would I reference the session.sessionid in the code behind and then retrieve that in the asp hyperlink?

Thanks in advance.


<ch***@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
Hi Seaside,

I think I've figured out how to do it. May or may not work for you. My
menu
is an asp.net menu created server side, so i've basically changed the base url (ie: "/site/") to "/site/(sjkfj23jsdfjlsdkfj)/" note - the

sjkfj23....
etc. is referenced in code behind using session.sessionID

If your menu is generated server side, then this will work for you.
If it's
just a client-side menu that you don't generate in code, then it
won't.
Hope that helps???

Chris

"Seaside" <ss@hotmail.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
> I had the same problem and wound up changing the menu system so that

my > navigation is in 4 different controls vs. one. Each control is located in
a
> position so that it can use relative paths with respect to the page.
Instead
> of making a change in one nav control I have to make it in 4 but it
is still
> worth it in order to use cookie munging. My users refuse to allow

cookies.
> Hope your post results in a better option , I'd love to get back to

using
> one nav control vs 4.
>
>
> <ch***@yahoo.com> wrote in message
> news:ex*************@tk2msftngp13.phx.gbl...
> > Hi,
> >
> > I'm trying to use the cookie munging session handling behaviour of
asp.net
> > instead of cookies themselves as I'm finding quite a few people are > barring
> > cookies (especially AOL users). If I change the setting in web.config > > everything seems to work fine as long as I'm using relative paths.

The
> > problem is I've got a menuing system that's generated from a site-wide > > template - so I use a fixed path from the application root - (ie:
> > /application/sub-dir/page.aspx) because I don't actually know
where the
> > user is at any given moment because it's a site-wide menu.
> >
> > Whenever someone clicks on one of them, the Session ID gets wiped

from the
> > URL and the user gets logged out. Am I missing something really

stupid
> > here? How can I persist the SessionID in these URLs?
> >
> > Cheers
> >
> > Chris
> >
> >
>
>



Nov 17 '05 #6

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

Similar topics

18
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
18
by: Ralf W. Grosse-Kunstleve | last post by:
My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... And Now for Something Completely Different: class autoinit(object):...
7
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but...
5
by: brettr | last post by:
When I reference document.cookie, there is a long string of key=value; pairs listed. I may have 100 hundred cookies on my hard drive. However, most only have one key=value pair. Does the...
0
by: | last post by:
Hi, I'm trying to use the cookie munging session handling behaviour of asp.net instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
6
by: kelvlam | last post by:
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...
5
by: SJ | last post by:
Hi, In my website, i have a cookie that allows the user to remain logged in for upto 90days. So I'm setting the cookie expiration time to 90 days in the future from the time the user logs in....
1
by: ntran005 | last post by:
Hi I have a new ASP.NET 2.0 web site installed side by side with existing ASP 3.0 web sites, each under a different domain, like this: https://dotnetapp.mycompany.com https://app1.mycompany.com...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
1
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...
0
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...
0
agi2029
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.