Solved

Session/Cookies Not Persisting on Web Server

Posted on 2010-11-10
6
508 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:adilkhan
Comment Utility
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
Comment Utility
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
Comment Utility
As an additional piece of evidence - the test app works with FireFox, but not with IE8 or IE7.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:wframsay
Comment Utility
Is this thing on?
0
 
LVL 1

Accepted Solution

by:
wframsay earned 0 total points
Comment Utility
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
Comment Utility
I accepted my own solution as nobody answered after the first question on this item.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now