473,320 Members | 1,902 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.

FormsAuthentication.SetAuthCookie issue with domains w/o www

Hopefully someone seen this and knows best way around it.

When using FormsAuthentication and using FormsAuthentication.SetAuthCookie,
ASP.NET creates a cookie similar to the domain URL. For example, if the user
navigates to www.domain.com and logs in, then the cookie is associated with
www.domain.com. Even though the user is authentication to the domain, if a
link on the site goes to domain.com (without the www), the user is prompted
to login again!

I was trying to detect the domain the user is hitting using the URI object,
but the URI object tends to return domain.com rather than www.domain.com at
times even though the user navigated to www.domain.com and that is causing
my application to misbehave due to the cookie issue.

Here is an example of the problem:

Go to http://www.asp.net/PortalStarterKit/DesktopDefault.aspx that is
Microsoft's starterkit.
Login to the site and make sure you are logged in
Change the URL to http://asp.net/PortalStarterKit/DesktopDefault.aspx and
you will notice that you are no longer authenticated
change it back to http://www.asp.net/PortalStarterKit/DesktopDefault.aspx
and your authentication is picked up.


Nov 19 '05 #1
0 1944

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

Similar topics

2
by: G-Fit | last post by:
Hello group, I use Forms Authentication in my web application and I am not sure I understand the way the cookie works. I use the SetAuthCookie method with a database identifier as userName, as...
1
by: dotCore | last post by:
Hi, I have VS2003.NET, XP Pro and SQL 2000. The .NET framework is 1.1 The problem I am having with the source code is that I cannot authenticate any user. The sproc returns the user name from...
1
by: Bryan | last post by:
Hi, here's my cod If AuthorizeUser(txtUsername.Text, txtPassword.Text) The If Request.QueryString("ReturnURL") > "" The FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, False Els...
3
by: Phil Certain | last post by:
Hi I'm building a site that has publicly available pages and password protected pages. Publicly available pages reside in: /public and password protected pages reside in: /private
2
by: tshad | last post by:
I have a logon page that is may be called by the Forms Authentication setup. This would put a ReturnURL as part of the URL. I would normally then just issue a: ...
4
by: Matthias S. | last post by:
Hi there, I've created an application which is using Forms-based authentification. My Login-Button event handler looks somewhat like this: // validate the input, etc... // sUserName holds now...
3
by: David | last post by:
Hi all, I am having a slight issue with FormsAuthentication. I need to authenticate a user and while the page is still being processed, need to work with that authenticated user. I have set up...
2
by: Cirene | last post by:
FormsAuthentication.SetAuthCookie works fine in IE7, but not in IE6. Any idea why? Any alternative to FormsAuthentication.SetAuthCookie? Here's my code: ...
0
by: Rodrigo m. Ferreira | last post by:
Can you help me to solve the following problem? on my loggin page I have the code: protected void LoginButton_Click(object sender, EventArgs e) { if(Membership.ValidateUser(TXTUsuario.Text,...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.