473,770 Members | 3,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FormsAuthentica tion.SetAuthCoo kie issue with domains w/o www

Hopefully someone seen this and knows best way around it.

When using FormsAuthentica tion and using FormsAuthentica tion.SetAuthCoo kie,
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 1960

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

Similar topics

2
1549
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 I would like the website to remember who is logged in (and I guess it doesn't matter wether I store a name or an identifier, which is much more convenient for me) :
1
1145
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 database which also means that the user should be authenticated. It runs the SetAuthCookie method with success. The resulting page is no different than the initial page. The login component is still there. When I try to access an admin page directly...
1
1191
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 FormsAuthentication.SetAuthCookie(txtUsername.Text, False Response.Redirect("Checkout.aspx" End I End I
3
3606
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
3499
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: FormsAuthentication.RedirectFromLoginPage(logon.txt,true) But I also am giving them an option to register which would go to a new page. From this page, when they submit, I want to go the original page they were heading for (ReturnURL) when the went to the logon page.
4
8329
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 the users name FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, sUserName, DateTime.Now, DateTime.Now.AddMinutes(20),false,
3
4917
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 a test page as follows... private void Page_Load(object sender, System.EventArgs e) {
2
2931
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: FormsAuthentication.SetAuthCookie(Convert.ToString(Request("lexusername") & ""), True)
0
2888
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, TXTSenha.Text)) {
0
9425
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
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, 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...
0
10057
jinu1996
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...
0
9869
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8883
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, 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...
1
7415
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.