473,396 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Session_Start and Microsoft Word 2002 bug?

Someone please explain why Session_Start fires multiple times /
retains SessionID values between sessions, when you open an ASP.NET
page from MS Word. For details of the problem, see below:

1. Create a new C# ASP.NET web application named "demo" and modify
Session_Start in Global.asax.cs as follows:

protected void Session_Start(Object sender, EventArgs e)
{
Response.Write("Session_Start event fired at "+
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss<BR><BR>"));
}

2. Modify Page_Load in WebForm1.aspx.cs as follows:

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("SESSION ID = "+ Session.SessionID +"<BR><BR>");
Response.Write("<A HREF=\"WebForm1.aspx\">Reload
page</A><BR><BR>");
}

3. Build the project.
4. Open Internet Explorer and navigate to
http://localhost/demo/WebForm1.aspx.
You should see the following text:

Session_Start event fired at <YYYY-MM-DD HH:MM:SS>
Session Id = <XXX>

And if you click the "reload page" link, the "Session_Start" text
should disappear (because Session_Start has already been fired). The
"Session Id" text, however, should remain and have the same value
(because we're still in the same session).

Now, that is how it *should* be working. However, if you close all
Internet Explorer windows and replace step 4 with the following,
that's when things start to behave really weird...
1. If Microsoft Word 2002 is open – exit the program.
2. If Internet Explorer is open – exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session
Id.
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window!

Another, even more interesting twist to the same problem surfaces if
you replace step 4 with the following:

1. If Microsoft Word 2002 is open – exit the program.
2. If Internet Explorer is open – exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session Id
(write down these values for comparison later on).
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window
(write down these values for comparison later on)!
8. Close Internet Explorer but leave Microsoft Word 2002 running.
9. Click the link again, thereby opening WebForm1.aspx in a new
Internet Explorer window.
10. Notice how Session_Start *appears* to fire anew, but how both the
time stamp and the Session Id retain the values as before you closed
Internet Explorer!
What the heck is going on here?

Brgds,

Niklas Uhlin
System Developer
CSC
Nov 18 '05 #1
5 2153
http://www.csharphelp.com/archives3/archive540.html

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Niklas Uhlin" <so*************@hotmail.com> wrote in message
news:af**************************@posting.google.c om...
Someone please explain why Session_Start fires multiple times /
retains SessionID values between sessions, when you open an ASP.NET
page from MS Word. For details of the problem, see below:

1. Create a new C# ASP.NET web application named "demo" and modify
Session_Start in Global.asax.cs as follows:

protected void Session_Start(Object sender, EventArgs e)
{
Response.Write("Session_Start event fired at "+
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss<BR><BR>"));
}

2. Modify Page_Load in WebForm1.aspx.cs as follows:

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("SESSION ID = "+ Session.SessionID +"<BR><BR>");
Response.Write("<A HREF=\"WebForm1.aspx\">Reload
page</A><BR><BR>");
}

3. Build the project.
4. Open Internet Explorer and navigate to
http://localhost/demo/WebForm1.aspx.
You should see the following text:

Session_Start event fired at <YYYY-MM-DD HH:MM:SS>
Session Id = <XXX>

And if you click the "reload page" link, the "Session_Start" text
should disappear (because Session_Start has already been fired). The
"Session Id" text, however, should remain and have the same value
(because we're still in the same session).

Now, that is how it *should* be working. However, if you close all
Internet Explorer windows and replace step 4 with the following,
that's when things start to behave really weird...
1. If Microsoft Word 2002 is open - exit the program.
2. If Internet Explorer is open - exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session
Id.
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window!

Another, even more interesting twist to the same problem surfaces if
you replace step 4 with the following:

1. If Microsoft Word 2002 is open - exit the program.
2. If Internet Explorer is open - exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session Id
(write down these values for comparison later on).
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window
(write down these values for comparison later on)!
8. Close Internet Explorer but leave Microsoft Word 2002 running.
9. Click the link again, thereby opening WebForm1.aspx in a new
Internet Explorer window.
10. Notice how Session_Start *appears* to fire anew, but how both the
time stamp and the Session Id retain the values as before you closed
Internet Explorer!
What the heck is going on here?

Brgds,

Niklas Uhlin
System Developer
CSC

Nov 18 '05 #2
> http://www.csharphelp.com/archives3/archive540.html

How does this explain the fact that even though *all* MSIE windows
have been closed, Session_Start appears to fire anew, but the Session
ID retains the value it had prior to closing all the windows, if you
reopen the page from Word?

There's got to be something wrong here?

Brgds,

Niklas
Nov 18 '05 #3
Ok, I'll take a closer look at it this weekend

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Niklas Uhlin" <so*************@hotmail.com> wrote in message
news:af**************************@posting.google.c om...
http://www.csharphelp.com/archives3/archive540.html


How does this explain the fact that even though *all* MSIE windows
have been closed, Session_Start appears to fire anew, but the Session
ID retains the value it had prior to closing all the windows, if you
reopen the page from Word?

There's got to be something wrong here?

Brgds,

Niklas

Nov 18 '05 #4
I don't have word 02. i substituted word 03 for it. i get the same results
as u. here is my analysis.
1. If Microsoft Word 2002 is open - exit the program.
2. If Internet Explorer is open - exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session
Id.
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window!

Another, even more interesting twist to the same problem surfaces if
you replace step 4 with the following:
I believe MS Word generated links are handled differently that other
applications so that a link which fires from MS Word is considered one
session, but clicking the link inside the aspx page generates another
session because the second click does not originate from inside MS Word.
MSWord for one, aspx page for the other. I've concluded this because,
substituting MS Word for Outlook Express for example yields different
results.

1. If Microsoft Word 2002 is open - exit the program.
2. If Internet Explorer is open - exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session Id
(write down these values for comparison later on).
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window
(write down these values for comparison later on)!
8. Close Internet Explorer but leave Microsoft Word 2002 running.
9. Click the link again, thereby opening WebForm1.aspx in a new
Internet Explorer window.
10. Notice how Session_Start *appears* to fire anew, but how both the
time stamp and the Session Id retain the values as before you closed
Internet Explorer!
This is a bit wierd but actually what is going on is IE is caching the
result of the page on the first pass. Even if the second pass fires a new
window and a new session id, IE chooses to display the old results because
of caching. You will find that this fails to happen if you clear your cache
or if you disable caching programmatically using
Response.Cache.SetCacheability(HttpCacheability.Se rverAndNoCache); I'm not
convinced that the caching needs to happen since the request is new but it
does seem to happen consistently with MS Word. This behavior does not happen
in Outlook.

A bug? Not sure. I'm not sure because i don't know how the architecture is
built for referrers which originate from MS Word as opposed to other
clients.
I'm keeping this thread so that the whidbey people can have a more
consistent behavior for whidbey.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Niklas Uhlin" <so*************@hotmail.com> wrote in message
news:af**************************@posting.google.c om... Someone please explain why Session_Start fires multiple times /
retains SessionID values between sessions, when you open an ASP.NET
page from MS Word. For details of the problem, see below:

1. Create a new C# ASP.NET web application named "demo" and modify
Session_Start in Global.asax.cs as follows:

protected void Session_Start(Object sender, EventArgs e)
{
Response.Write("Session_Start event fired at "+
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss<BR><BR>"));
}

2. Modify Page_Load in WebForm1.aspx.cs as follows:

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("SESSION ID = "+ Session.SessionID +"<BR><BR>");
Response.Write("<A HREF=\"WebForm1.aspx\">Reload
page</A><BR><BR>");
}

3. Build the project.
4. Open Internet Explorer and navigate to
http://localhost/demo/WebForm1.aspx.
You should see the following text:

Session_Start event fired at <YYYY-MM-DD HH:MM:SS>
Session Id = <XXX>

And if you click the "reload page" link, the "Session_Start" text
should disappear (because Session_Start has already been fired). The
"Session Id" text, however, should remain and have the same value
(because we're still in the same session).

Now, that is how it *should* be working. However, if you close all
Internet Explorer windows and replace step 4 with the following,
that's when things start to behave really weird...
1. If Microsoft Word 2002 is open - exit the program.
2. If Internet Explorer is open - exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session
Id.
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window!

Another, even more interesting twist to the same problem surfaces if
you replace step 4 with the following:

1. If Microsoft Word 2002 is open - exit the program.
2. If Internet Explorer is open - exit the program.
3. Open Microsoft Word 2002
4. Type the following into a new document:
http://localhost/demo/WebForm1.aspx.
5. Click the link, thereby opening WebForm1.aspx in a new Internet
Explorer window.
6. Notice how Session_Start fires and how you're assigned a Session Id
(write down these values for comparison later on).
7. Now click the "reload page" link and notice how Session_Start is
fired again(!) and how you're assigned a brand new Session Id(!) even
though the page is reloaded in the same Internet Explorer window
(write down these values for comparison later on)!
8. Close Internet Explorer but leave Microsoft Word 2002 running.
9. Click the link again, thereby opening WebForm1.aspx in a new
Internet Explorer window.
10. Notice how Session_Start *appears* to fire anew, but how both the
time stamp and the Session Id retain the values as before you closed
Internet Explorer!
What the heck is going on here?

Brgds,

Niklas Uhlin
System Developer
CSC

Nov 18 '05 #5
Thank you!!

I think Response.Cache.SetCacheability(HttpCacheability.Se rverAndNoCache)
will solve our problem =)

Brgds,

Niklas
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

163
by: Shiperton Henethe | last post by:
Hi Know any good utilities to help me strip out the tags that Microsoft Excel 2002 leaved behind when you try and export an HTML format file? This is driving me NUTS. And really makes me...
1
by: Mercy | last post by:
Hi, I'm a newbie. I was trying to figure out how to use the Session_start method? The reference books I'm reading say that a session STARTS when "session_start" is called. But ... in their sample...
0
by: Chris J | last post by:
Hi all, ] I'm having a problem with Word 2002 when downloading a Word document with IE6. This is in an intranet application, and the download occurs through an ASP that does security checks...
7
by: Andy Davis | last post by:
I have a table of data in Access 2002 which is used as the source table for a mail merge document using Word 2002 on my clients PC. The data is transferred OK but I've noticed that any dates which...
5
by: Gabriel Lozano-Morán | last post by:
Is there any particular reason why the Session_Start() event gets triggerend by each aspx page request? Details: Windows XP Pro SP2 ..NET Framework v1.1.4322 C# SessionState set to mode...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
0
by: dermot | last post by:
I have a VB.NET application which creates Microsoft office word documents (using interop). This works fairly fast on machines with Office (Word) 2002 installed. however the code takes about 15...
2
by: djamila | last post by:
Hi, I work in a c# project that uses Microsoft Word to generate report. In my program I use Interop.Word reference. When I run the program in my PC with Microsoft Word 2003, all work well....
4
by: =?Utf-8?B?QXJ0?= | last post by:
Hello, I saw this posting and it is the closest place to ask this question. I am simply trying to create a Word document from a VB application I am wrting with Visual Studio 2005. I cut a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.