473,796 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

authentication cookie not persist

BH
I developed a small web app using the FormsAuthentica tion class to set a
cookie (FormsAuthentic ation.SetAuthCo okie(value, isPersist)). The cookie
persists fine on my local PC when "isPersist" is true and I can see the
cookie file in the cookies folder on my disk. However, after I migrated the
application to a server, the cookie is no longer written to the disk. It's
still in memory and as long as I don't close the browser instance, the user
is kept authenticated, but the cookie just doesn't persist to the disk.
It's exactly the same build and the virtual dirs are the same too. Any
environment change I have to make to the .NET framework on the server?

Thanks for any suggestions.

Bob
Nov 17 '05 #1
2 2561
"BH" <bo*******@yaho o.com> wrote in message
news:Oq******** ******@TK2MSFTN GP09.phx.gbl...
Both my PC and the server are on the same Windows network domain if that's
what you meant.
No. I meant domain in terms of cookies. For instance, for a cookie set for
http://msdn.microsoft.com could be set for domain "msdn.microsoft .com", in
which case it would be sent to all pages under msdn.microsoft. com or
foo.msdn.micros oft.com. It would not be sent to www.microsoft.com. But if
the domain were set to "microsoft.com" , the cookie would be sent both to
msdn.microsoft. com and www.microsoft.com.

The domain for http://localhost/ is string.Empty.
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com
I also found that any authentication ticket created and added to
Response.Cookie s doesn't persist. However, if I just add a plain cookie
(like the two lines below), it persists regardless whether the web app is on my PC or on the server.
Response.Cookie s["test"].Value = "abc";
Response.Cookie s["test"].Expires = DateTime.Now(). AddDays(3);

"John Saunders" <jo***********@ surfcontrol.com > wrote in message
news:uM******** ******@TK2MSFTN GP10.phx.gbl...
"BH" <bo*******@yaho o.com> wrote in message
news:u9******** ******@TK2MSFTN GP09.phx.gbl...
I developed a small web app using the FormsAuthentica tion class to set a cookie (FormsAuthentic ation.SetAuthCo okie(value, isPersist)). The cookie persists fine on my local PC when "isPersist" is true and I can see the cookie file in the cookies folder on my disk. However, after I migrated
the
application to a server, the cookie is no longer written to the disk.

It's
still in memory and as long as I don't close the browser instance, the

user
is kept authenticated, but the cookie just doesn't persist to the
disk. It's exactly the same build and the virtual dirs are the same too. Any environment change I have to make to the .NET framework on the server?


This sounds like it might be an issue with browser security settings.

Your browser is willing to accept the cookie, but is not willing to persist it.
Is the domain different between your server and your local PC? Is it being set when your code is running on the server?
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com


Nov 17 '05 #2
BH
ic, but I don't see how you can set the cookie domain when calling
FormsAuthentica tion.SetAuthCoo kie.

Another thing is I tried the app directly in IE on the server via Terminal
Service using the http://localhost/myApp , the cookie is not written to the
disk either....

"John Saunders" <jo***********@ surfcontrol.com > wrote in message
news:OR******** ******@TK2MSFTN GP12.phx.gbl...
"BH" <bo*******@yaho o.com> wrote in message
news:Oq******** ******@TK2MSFTN GP09.phx.gbl...
Both my PC and the server are on the same Windows network domain if that's
what you meant.
No. I meant domain in terms of cookies. For instance, for a cookie set for
http://msdn.microsoft.com could be set for domain "msdn.microsoft .com", in
which case it would be sent to all pages under msdn.microsoft. com or
foo.msdn.micros oft.com. It would not be sent to www.microsoft.com. But if
the domain were set to "microsoft.com" , the cookie would be sent both to
msdn.microsoft. com and www.microsoft.com.

The domain for http://localhost/ is string.Empty.
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com
I also found that any authentication ticket created and added to
Response.Cookie s doesn't persist. However, if I just add a plain cookie
(like the two lines below), it persists regardless whether the web app

is on
my PC or on the server.
Response.Cookie s["test"].Value = "abc";
Response.Cookie s["test"].Expires = DateTime.Now(). AddDays(3);

"John Saunders" <jo***********@ surfcontrol.com > wrote in message
news:uM******** ******@TK2MSFTN GP10.phx.gbl...
"BH" <bo*******@yaho o.com> wrote in message
news:u9******** ******@TK2MSFTN GP09.phx.gbl...
> I developed a small web app using the FormsAuthentica tion class to set
a > cookie (FormsAuthentic ation.SetAuthCo okie(value, isPersist)). The

cookie
> persists fine on my local PC when "isPersist" is true and I can see the > cookie file in the cookies folder on my disk. However, after I migrated the
> application to a server, the cookie is no longer written to the
disk. It's
> still in memory and as long as I don't close the browser instance, the user
> is kept authenticated, but the cookie just doesn't persist to the

disk. > It's exactly the same build and the virtual dirs are the same too. Any > environment change I have to make to the .NET framework on the server?
This sounds like it might be an issue with browser security settings. Your browser is willing to accept the cookie, but is not willing to persist it.
Is the domain different between your server and your local PC? Is it being set when your code is running on the server?
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com



Nov 17 '05 #3

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

Similar topics

6
1350
by: Stefano Mostarda | last post by:
Hi buddies, I have a question. I want to use the forms authentication in my web app. My user login. The cookie is stored in the client machine and some important information is stored in session variables. What will happen if the user closes the browser and reopen to relog in
5
2879
by: Gavin Stevens | last post by:
I'm trying to figure out the ASP.NET Forms Auth I have 3 or 4 pages i want to allow anonymous access to.. Then I have 5 or 6 pages I placed in another directory in the webproject. These I want to manually authenticate users to provide acess My project has 2 web.config files... the default file <authentication mode="Forms"><forms loginUrl="Login.aspx" protection="All" timeout="30"...
2
2386
by: mike parr | last post by:
I'm using forms authentication and on my first page I want to check if the user has a cookie, and if they do I want to authenticate then and send them to my default page with a greeting, otherwise send them to a login page. I've seen a lot of examples on the internet where the user login details are checked and then RedirectFromLoginPage is used, but I haven't seen anything on simply authenticating the user and then sending them to a...
4
2349
by: Lloyd Sheen | last post by:
Way too many times while debugging I click a menu button to go to a page which needs authentication to happen. The logon form is not shown. I have closed VS2003, stopped IIS and restarted but to no avail. Any ideas? Lloyd Sheen
1
253
by: I am Sam | last post by:
Can someone tell me what is wrong with this code? When I test it it does nothing but return to the log in page. As far as I can see the web.config is working fine and the authentication element is without any problem. I think it could be a problem with the cookie ticket but I don't know how I can confirm. Any suggestions would be greatly appreciated. Thank you Sam- public class Login : System.Web.UI.Page
2
2744
by: pv_kannan | last post by:
I recently found out that my authentication cookies are not expiring even though I have set the persist property to false. As a result, users are able to access the secure websites with indifferent results. Any pointers/suggestions would be very appreciated. Things were running as usual till until recently. Here are the relevant pieces of code ==========================================
2
1713
by: Randall Parker | last post by:
Some questions on forms authentication: 1) Can one do one's own checking of username and password and totally bypass calling FormsAuthentication.Authenticate? 2) does the "new FormsAuthenticationTicket" create a cookie? 3) Can one send the cookie back to the browser just by doing the new call on the FormsAuthenticationTicket?
1
4690
by: Mark Olbert | last post by:
I'm building an ASPNET2 website which uses forms authentication but does not use the Microsoft-supplied membership providers (mostly because I don't want to create my own provider at this point, and the supplied stuff comes with a lot of baggage I don't want/need). In ASPNET1.1 what I would do was something like the following, after authenticating the user on the login form: FormsAuthentication.SetAuthCookie(userInfo.UserID, false); ...
4
424
by: =?Utf-8?B?R3V1czEyMw==?= | last post by:
Hi, I created a web site on a remote server. To logon the user must enter a user id and password. The site is uses Forms Authentication. The web config file looks as follows: <configuration> <system.web> <customErrors mode="Off"/>
0
9685
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
9535
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
10465
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...
1
10200
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
9061
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
7558
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
6800
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4127
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
3744
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.