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
Solved

Session/Cookies Not Persisting on Web Server

Posted on 2010-11-10
6
522 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

839 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