?
Solved

Session/Cookies Not Persisting on Web Server

Posted on 2010-11-10
6
Medium Priority
?
542 Views
Last Modified: 2012-05-10
I have an intranet ASP.NET application that I am trying to deploy to a web server. Running the application on my development IIS server works fine, but on the web server, while the application runs, it does not save any cookie or session information. So, I created a test program to see if there was something wrong with my larger application, and the same behavior occurs, i.e., the devlopment server runs fine but web server still cannot save cookies (I didn't bother with session variables yet).

The code for the two pages in the test app is as follows:
Set Cookies (default.aspx):

protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie myCookie = new HttpCookie("UserSettings");
            myCookie["Font"] = "Arial";
            myCookie["Color"] = "Blue";
            Response.Cookies.Add(myCookie);
        }


Read Cookie:

if (Request.Cookies["UserSettings"] != null)
            {
                if (Request.Cookies["UserSettings"]["Font"] != null)
                {
                    Label1.Text += Request.Cookies["UserSettings"]["Font"];
                }
            }

Open in new window

0
Comment
Question by:wframsay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 34106996
you writing and reading cookies on same domain

for example: yahoo.com is NOT same as www.yahoo.com

what version of IIS and Windows server are you using?
0
 
LVL 1

Author Comment

by:wframsay
ID: 34111332
The test application is only running in a single domain (on our internal network). The example shown above is running in two separate ASPX pages on the same server.

We are using IIS 7, Windows Server 2008 R2 Standard, 64-bit.

The following Role Services are installed on the server:
Web Server
   Common HTTP Features
   Static Content
   Default Document
   Directory Browsing
   HTTP Errors
Application Development
   ASP.NET
   .NET Extensibility
   ISAPI Extensions
   ISAPI Filters
Security
   Windows Authentication
   Request Filtering
Management Tools
   IIS Management Console
0
 
LVL 1

Author Comment

by:wframsay
ID: 34121212
As an additional piece of evidence - the test app works with FireFox, but not with IE8 or IE7.
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
LVL 1

Author Comment

by:wframsay
ID: 34157623
Is this thing on?
0
 
LVL 1

Accepted Solution

by:
wframsay earned 0 total points
ID: 34305490
I was able to fix this by removing the underscore from the server name. Apparntly, IE8 doesn't like underscores in server names, so it assumes that you have switched Trust Zones each time you load a new page.
0
 
LVL 1

Author Closing Comment

by:wframsay
ID: 34333027
I accepted my own solution as nobody answered after the first question on this item.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question