473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to keep cookies after authentication redirect??

Hi,

I better get the background stuff out the way first, so here goes:

- Porting a VB6 webclass app to VB.NET using HttpHandlers and
FormsAuthentication
- When someone visits my site unbeknown to them they are automatically
logged in as a guest
via the .NET forms authentication.

PROBLEM:
I need to store a couple of session cookies. But after my
auto-login-as-guest ASPX page has
been called by FormsAuthentication it does an internal redirection to
the page the user actually
asked for (probably the home page) having set a couple of session
cookies.

Any way because the redirect is internal the session cookies never get
sent to the user and also
the redirect causes the HttpContext to be changed hence the session
cookies I just set get lost,
damn it!

I presently have a hack solution which is to set a global variable with
the entire cookie string and
then (with my Asp cookie wrapper class) set it again when I get to the
redirect page using the
global variable. Which works in a single user test environment, but when
multiple users start
hitting the site it is possible that this global variable could get
messed up between users.

HOW TO:
So how do I get these couple of session cookies to stick until they get
to the destination of the
redirect?

Is there any way I could append them to the URL that the
FormsAuthentication sutff redirects
to?

Any help or suggestions would be much appreciated.
Regards,
Peter Row
Nov 18 '05 #1
3 7814
okay i guess you are using FormsAuthentication.RedirectFromLoginPage() to
return to the original url the user tried to access.
what happens is that RedirectFromLoginPage() method over writes the
cookie...

what you need to do is manually create an authentication ticket... write it
to a cookie... and then do a manual redirect
ie read the querystring for returnURL params and then Response.Redirect if
it in is not "" or return to "/"

i think i did post a part of code a few days back if you want to have a look
at it...

--

Regards,

HD
"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi,

I better get the background stuff out the way first, so here goes:

- Porting a VB6 webclass app to VB.NET using HttpHandlers and
FormsAuthentication
- When someone visits my site unbeknown to them they are automatically
logged in as a guest
via the .NET forms authentication.

PROBLEM:
I need to store a couple of session cookies. But after my
auto-login-as-guest ASPX page has
been called by FormsAuthentication it does an internal redirection to
the page the user actually
asked for (probably the home page) having set a couple of session
cookies.

Any way because the redirect is internal the session cookies never get
sent to the user and also
the redirect causes the HttpContext to be changed hence the session
cookies I just set get lost,
damn it!

I presently have a hack solution which is to set a global variable with the entire cookie string and
then (with my Asp cookie wrapper class) set it again when I get to the
redirect page using the
global variable. Which works in a single user test environment, but when multiple users start
hitting the site it is possible that this global variable could get
messed up between users.

HOW TO:
So how do I get these couple of session cookies to stick until they get to the destination of the
redirect?

Is there any way I could append them to the URL that the
FormsAuthentication sutff redirects
to?

Any help or suggestions would be much appreciated.
Regards,
Peter Row

Nov 18 '05 #2
Hi,

Thanks for the pointers.

I haven't tried it yet but I have put in a :

FormsAuthentication.SetAuthCookie()
Response.Redirect(FormsAuthentications.GetRedirect Url())

Which on face value looks like it should work fine.

Thanks,
Pete
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
okay i guess you are using FormsAuthentication.RedirectFromLoginPage() to
return to the original url the user tried to access.
what happens is that RedirectFromLoginPage() method over writes the
cookie...

what you need to do is manually create an authentication ticket... write it to a cookie... and then do a manual redirect
ie read the querystring for returnURL params and then Response.Redirect if
it in is not "" or return to "/"

i think i did post a part of code a few days back if you want to have a look at it...

--

Regards,

HD
"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi,

I better get the background stuff out the way first, so here goes:

- Porting a VB6 webclass app to VB.NET using HttpHandlers and
FormsAuthentication
- When someone visits my site unbeknown to them they are automatically
logged in as a guest
via the .NET forms authentication.

PROBLEM:
I need to store a couple of session cookies. But after my
auto-login-as-guest ASPX page has
been called by FormsAuthentication it does an internal redirection to the page the user actually
asked for (probably the home page) having set a couple of session
cookies.

Any way because the redirect is internal the session cookies never get sent to the user and also
the redirect causes the HttpContext to be changed hence the session
cookies I just set get lost,
damn it!

I presently have a hack solution which is to set a global variable

with
the entire cookie string and
then (with my Asp cookie wrapper class) set it again when I get to the redirect page using the
global variable. Which works in a single user test environment, but

when
multiple users start
hitting the site it is possible that this global variable could get
messed up between users.

HOW TO:
So how do I get these couple of session cookies to stick until they

get
to the destination of the
redirect?

Is there any way I could append them to the URL that the
FormsAuthentication sutff redirects
to?

Any help or suggestions would be much appreciated.
Regards,
Peter Row


Nov 18 '05 #3
yeap as long as you are not using RedirectFromLoginPage() but using
Respone.redirect().
the authentication cookie you set should be alright...

--

Regards,

HD
"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Hi,

Thanks for the pointers.

I haven't tried it yet but I have put in a :

FormsAuthentication.SetAuthCookie()
Response.Redirect(FormsAuthentications.GetRedirect Url())

Which on face value looks like it should work fine.

Thanks,
Pete
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
okay i guess you are using FormsAuthentication.RedirectFromLoginPage() to
return to the original url the user tried to access.
what happens is that RedirectFromLoginPage() method over writes the
cookie...

what you need to do is manually create an authentication ticket... write

it
to a cookie... and then do a manual redirect
ie read the querystring for returnURL params and then Response.Redirect if it in is not "" or return to "/"

i think i did post a part of code a few days back if you want to have a

look
at it...

--

Regards,

HD
"Peter Row" <pe*******@oxfordcc.co.uk> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi,

I better get the background stuff out the way first, so here goes:

- Porting a VB6 webclass app to VB.NET using HttpHandlers and
FormsAuthentication
- When someone visits my site unbeknown to them they are automatically
logged in as a guest
via the .NET forms authentication.

PROBLEM:
I need to store a couple of session cookies. But after my
auto-login-as-guest ASPX page has
been called by FormsAuthentication it does an internal redirection to the page the user actually
asked for (probably the home page) having set a couple of session
cookies.

Any way because the redirect is internal the session cookies never get sent to the user and also
the redirect causes the HttpContext to be changed hence the session cookies I just set get lost,
damn it!

I presently have a hack solution which is to set a global variable

with
the entire cookie string and
then (with my Asp cookie wrapper class) set it again when I get to the redirect page using the
global variable. Which works in a single user test environment, but when
multiple users start
hitting the site it is possible that this global variable could
get messed up between users.

HOW TO:
So how do I get these couple of session cookies to stick until

they get
to the destination of the
redirect?

Is there any way I could append them to the URL that the
FormsAuthentication sutff redirects
to?

Any help or suggestions would be much appreciated.
Regards,
Peter Row



Nov 18 '05 #4

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

Similar topics

3
by: Gurtch | last post by:
Hi, I've got the following code : if (empty($g_view_all_cookie_val)) { $t_settings_string = "v1#any#any#any#"; setcookie($g_view_all_cookie, $t_settings_string/** * DG,...
1
by: Mark Aurit | last post by:
I have an intranet application that uses w2k Integrated Windows Authentication to authenticate users. We now have a situation where people will be accessing it who are on our network but will not...
5
by: Hung Huynh | last post by:
Hello, I have 2 separate web sites on 2 different boxes www.xyz.com on box 1 www2.xyz.com on box 2 Users log into box 1 via regular ASP/Database authentication, and I keep a session...
2
by: Simple Person | last post by:
I am using C# in ASP (Microsoft Visual Studio.Net) to try and create a cookie. I have cookies enabled on both of my computers, but when I use the following code (I have also tried the commented line...
1
by: Mr.KisS | last post by:
Hello, I use ASP.NET v2. But i think it's the same (if it is..) for 1.1! So, i wanna know if it's possible (like php) to use sessions AND/OR cookies authentication but not 1 or 0, not show the...
2
by: porko | last post by:
I want to be able to programmatically log a user in as a guest and redirect them to a different page. Is there any way to do a RedirectFromLoginPage() and explicity specify the page to which the...
0
by: Jan Erik Hansen | last post by:
I use form authentication in my application. It works fine when I access my web site directly with http://IP/mycatalog/login.aspx which after authentication redirect me to Meny.aspx But I have...
2
by: Frank Swarbrick | last post by:
I am trying to understand "client authentication" works. My environment is DB2/UDB LUW 8.2 on zSeries SLES9 as the database server and DB2 for VSE 7.4 as the client. We currently have DB2/LUW set...
3
by: trihaitran | last post by:
Hi I am trying to pull some data from a Web site: http://schoolfinder.com The issue is that I want to use the advanced search feature which requires logging into the Web site. I have a username...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.