Solved

Session/Cookies Not Persisting on Web Server

Posted on 2010-11-10
6
526 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Server Event Log DSM Error-1000 10 34
GPO reset 2 45
NTP time source for DC 3 50
ASP.net Moving Visual Studio 2015 project to 2017 2 38
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

733 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