473,761 Members | 8,011 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 1958

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

Similar topics

2
1548
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
1144
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
1189
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
3604
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
4915
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
2887
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
9554
marktang
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...
0
9376
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
9988
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...
1
9923
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
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...
1
7358
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3911
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
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.