Solved

Session/Cookies Not Persisting on Web Server

Posted on 2010-11-10
6
538 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

690 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