By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,843 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,843 IT Pros & Developers. It's quick & easy.

ASP State Integration

P: n/a
gb
We are in the process of upgrading part of a large system
to .NET, whilst the majority will remain ASP. Sharing
session state information will not be a problem at the
moment as it is trivial and will be passed in using
QueryString.

More pressing is the synchronisation of session timeouts
between the two environments. Is the only way to do this
to have URL references from one environment to another.
For example on the ASP pages have an .aspx reference
somewhere, or on an ASP.NET page have a .asp reference?

How would one go about doing this? Using an img src
attribute, or a hidden IFRAME element?

Thanks,

gb
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

At first I was just going to post that I agree with you. An image tag or an
iframe is probably the easiest way for you to update "the other guy" with
the fact that activity has occurred and the server-side session time out
needs to be extended as well as the client-side cookie expiration.

However, I don't like the idea of adding an iframe if it's not necessary.
Also, an image tag needs to point to a valid image in order to avoid the
browser showing a red X. You could accomplish this by changing the IIS
application mappings for the ASP and ASP.NET applications to map *.bmp to
the ASP and ASP.NET DLL's. However, this would map all *.bmp files to
ASP/ASP.NET which would add overhead to your other *.bmp files.

---
Side notes
* You will need to manually update the *.xyz mapping when you update the
version of ASP.NET.

* If the end user changes the browser settings to not display images, then
the approach of using an image tag will not work. Similarly, not all
browsers support iframes.

* Application mappings is how IIS knows which program should process the
requested file. HTM and image files are usually just read from disk and
sent to the browser. For ASP and ASP.NET files, IIS calls into the
respective DLL. Then the DLL runs its various processes to render the file
to the browser. That's a lot more overhead.

* To set application mappings, open Internet Services Manager, properties
for the application's folder, Directory (or Virtual Directory) tab, click
the Configuration button, Mappings tab, look at the existing entries to see
how to add a new entry.
---

Back to the main topic.
You could rename a single pixel *.bmp file to *.xyz. Then, in the ASP.NET
application & ASP application respectively, map *.xyz to ASP & ASP.NET.
Then use IIS properties for the file to add necessary headers
(Content-Type: image/bmp and Cache-Control: no-cache). I didn't try this,
but I think this would be a reasonable solution for you.

Before I thought of changing the extension to *.xyz, I first came up with a
more complex idea which I did test and it worked. I don't think it's any
better than the *.xyz idea, but here it is. At least I tried this one and
found that it worked.

The idea is to have an ASPX page (you can convert it to ASP) which uses
BinaryWrite to send a one pixel bitmap. The overhead of programmatically
reading in a file to write it out seems like a lot of overhead for this
small administrative task. So, I monitored network activity while browsing
to a white, one pixel, monochrome bitmap file. Then I hard coded the bytes
into my code. Since it still has to read the ASPX or ASP file from disk,
this won't perform any better than the *.xyz approach.

Here is my sample code.

**** ASPX page
Remove everything except the @ Page declaration line.

When you do this, you will not be able to use the View In Browser feature
of Visual Studio. You will need to manually open a browser to view this
file.

**** Code-behind
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

Response.Buffer = True
Response.Clear()
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Response.Cache.SetExpires(#1/1/2001#)
Response.AppendHeader("Pragma", "no-Cache")
Response.ContentType = "image/bmp"

Dim b As Byte() = {66, 77, 66, 0, 0, 0, 0, 0, 0, _
0, 62, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, _
0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, _
255, 255, 0, 128, 0, 0, 0, 0, 6, 35, 65, 131, 71, _
17, 122, 6, 195, 124, 89, 134, 189}

Response.BinaryWrite(b)
End Sub
---
Other notes

* To avoid the need to remove the HTML from the ASPX page, you could
instead call Response.End() after BinaryWrite. However, the whole purpose
is to trigger activity by browsing something. Therefore, I don't want to
short-circuit the process.

* Since you mentioned this is a large ASP application and you are just
beginning to integrate it with or convert it to ASP.NET, I think you may
like to have more info on how to share ASP and ASP.NET session data. You
will need to remove the page breaks in these links to use them.

Download details: Code Sample: Session Sharing Between Classic ASP and
ASP.NET
http://www.microsoft.com/downloads/details.aspx?
familyid=8aa45bbc-6c0b-4dcf-b7b6-2f57e7c73587&displaylang=en

How to Share Session State Between Classic ASP and ASP.NET (ASP.NET
Technical Articles)
http://msdn.microsoft.com/library/en...rttoaspnet.asp
Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
Content-Class: urn:content-classes:message
From: "gb" <an*******@discussions.microsoft.com>
Sender: "gb" <an*******@discussions.microsoft.com>
Subject: ASP State Integration
Date: Wed, 7 Jan 2004 22:40:50 -0800
Lines: 18
Message-ID: <07****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcPVslsMeFaQvZGfT+qbI1k6Nvzs2Q==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:200524
NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

We are in the process of upgrading part of a large system
to .NET, whilst the majority will remain ASP. Sharing
session state information will not be a problem at the
moment as it is trivial and will be passed in using
QueryString.

More pressing is the synchronisation of session timeouts
between the two environments. Is the only way to do this
to have URL references from one environment to another.
For example on the ASP pages have an .aspx reference
somewhere, or on an ASP.NET page have a .asp reference?

How would one go about doing this? Using an img src
attribute, or a hidden IFRAME element?

Thanks,

gb


Nov 18 '05 #2

P: n/a
gb
Thanks for all the info, much appreciated!

Now, if I change IIS config to use ASP/ASP.NET to stream
*.xyz bitmaps to the browser do I reference this file URL
within an img src attribute? Can use a single pixel
transparent gif for this instead of a bitmap file?

As for ASP / ASP.NET session sharing, will this be fixed
in Whidbey, or will we have to wait for a new IIS in
Longhorn's server OS?
-----Original Message-----
Hi,

At first I was just going to post that I agree with you. An image tag or aniframe is probably the easiest way for you to update "the other guy" withthe fact that activity has occurred and the server-side session time outneeds to be extended as well as the client-side cookie expiration.
However, I don't like the idea of adding an iframe if it's not necessary.Also, an image tag needs to point to a valid image in order to avoid thebrowser showing a red X. You could accomplish this by changing the IISapplication mappings for the ASP and ASP.NET applications to map *.bmp tothe ASP and ASP.NET DLL's. However, this would map all *.bmp files toASP/ASP.NET which would add overhead to your other *.bmp files.
---
Side notes
* You will need to manually update the *.xyz mapping when you update theversion of ASP.NET.

* If the end user changes the browser settings to not display images, thenthe approach of using an image tag will not work. Similarly, not allbrowsers support iframes.

* Application mappings is how IIS knows which program should process therequested file. HTM and image files are usually just read from disk andsent to the browser. For ASP and ASP.NET files, IIS calls into therespective DLL. Then the DLL runs its various processes to render the fileto the browser. That's a lot more overhead.

* To set application mappings, open Internet Services Manager, propertiesfor the application's folder, Directory (or Virtual Directory) tab, clickthe Configuration button, Mappings tab, look at the existing entries to seehow to add a new entry.
---

Back to the main topic.
You could rename a single pixel *.bmp file to *.xyz. Then, in the ASP.NETapplication & ASP application respectively, map *.xyz to ASP & ASP.NET.Then use IIS properties for the file to add necessary headers(Content-Type: image/bmp and Cache-Control: no-cache). I didn't try this,but I think this would be a reasonable solution for you.

Before I thought of changing the extension to *.xyz, I first came up with amore complex idea which I did test and it worked. I don't think it's anybetter than the *.xyz idea, but here it is. At least I tried this one andfound that it worked.

The idea is to have an ASPX page (you can convert it to ASP) which usesBinaryWrite to send a one pixel bitmap. The overhead of programmaticallyreading in a file to write it out seems like a lot of overhead for thissmall administrative task. So, I monitored network activity while browsingto a white, one pixel, monochrome bitmap file. Then I hard coded the bytesinto my code. Since it still has to read the ASPX or ASP file from disk,this won't perform any better than the *.xyz approach.

Here is my sample code.

**** ASPX page
Remove everything except the @ Page declaration line.

When you do this, you will not be able to use the View In Browser featureof Visual Studio. You will need to manually open a browser to view thisfile.

**** Code-behind
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

Response.Buffer = True
Response.Clear()
Response.Cache.SetCacheability (HttpCacheability.NoCache) Response.Cache.SetExpires(#1/1/2001#)
Response.AppendHeader("Pragma", "no-Cache")
Response.ContentType = "image/bmp"

Dim b As Byte() = {66, 77, 66, 0, 0, 0, 0, 0, 0, _
0, 62, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, _ 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, _ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, _ 255, 255, 0, 128, 0, 0, 0, 0, 6, 35, 65, 131, 71, _ 17, 122, 6, 195, 124, 89, 134, 189}

Response.BinaryWrite(b)
End Sub
---
Other notes

* To avoid the need to remove the HTML from the ASPX page, you couldinstead call Response.End() after BinaryWrite. However, the whole purposeis to trigger activity by browsing something. Therefore, I don't want toshort-circuit the process.

* Since you mentioned this is a large ASP application and you are justbeginning to integrate it with or convert it to ASP.NET, I think you maylike to have more info on how to share ASP and ASP.NET session data. Youwill need to remove the page breaks in these links to use them.
Download details: Code Sample: Session Sharing Between Classic ASP andASP.NET
http://www.microsoft.com/downloads/details.aspx?
familyid=8aa45bbc-6c0b-4dcf-b7b6- 2f57e7c73587&displaylang=en
How to Share Session State Between Classic ASP and ASP.NET (ASP.NETTechnical Articles)
http://msdn.microsoft.com/library/en- us/dnaspp/html/converttoaspnet.asp

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit thehttp://www.microsoft.com/protect site and perform the three straightforwardsteps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "gb" <an*******@discussions.microsoft.com>
Sender: "gb" <an*******@discussions.microsoft.com>
Subject: ASP State Integration
Date: Wed, 7 Jan 2004 22:40:50 -0800
Lines: 18
Message-ID: <07****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcPVslsMeFaQvZGfT+qbI1k6Nvzs2Q==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:200524 NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

We are in the process of upgrading part of a large system to .NET, whilst the majority will remain ASP. Sharing
session state information will not be a problem at the
moment as it is trivial and will be passed in using
QueryString.

More pressing is the synchronisation of session timeouts between the two environments. Is the only way to do this to have URL references from one environment to another. For example on the ASP pages have an .aspx reference
somewhere, or on an ASP.NET page have a .asp reference?

How would one go about doing this? Using an img src
attribute, or a hidden IFRAME element?

Thanks,

gb


.

Nov 18 '05 #3

P: n/a
Hi,

Yes, I did have it mind that the *.xyz file would be referenced in the src
attribute of an img tag. If the idea works, then the file can contain any
data whose content-type is supported by the browser.

I was just thinking about another aspect. The *.xyz file will by handled by
the StaticFileHandler httpHandler per the machine.config file. I'm not sure
if that will trigger session renewal. If it doesn't work, use an *.aspx
file with BinaryWrite. It can read in a file or you can put the data
directly into the code as I demonstrated in my previous post.

I don't know how ASP session integration will be handled in the future
products whidbey or longhorn.

I hope this helps.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
Content-Class: urn:content-classes:message
From: "gb" <an*******@discussions.microsoft.com>
Sender: "gb" <an*******@discussions.microsoft.com>
References: <07****************************@phx.gbl> <rx**************@cpmsftngxa07.phx.gbl> Subject: RE: ASP State Integration
Date: Thu, 8 Jan 2004 21:10:08 -0800
Lines: 233
Message-ID: <00****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcPWbtnkMUoyZ/4pTcCbmdm0iVYoqA==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:200853
NNTP-Posting-Host: tk2msftngxa08.phx.gbl 10.40.1.160
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Thanks for all the info, much appreciated!

Now, if I change IIS config to use ASP/ASP.NET to stream
*.xyz bitmaps to the browser do I reference this file URL
within an img src attribute? Can use a single pixel
transparent gif for this instead of a bitmap file?

As for ASP / ASP.NET session sharing, will this be fixed
in Whidbey, or will we have to wait for a new IIS in
Longhorn's server OS?
-----Original Message-----
Hi,

At first I was just going to post that I agree with you.

An image tag or an
iframe is probably the easiest way for you to update "the

other guy" with
the fact that activity has occurred and the server-side

session time out
needs to be extended as well as the client-side cookie

expiration.

However, I don't like the idea of adding an iframe if

it's not necessary.
Also, an image tag needs to point to a valid image in

order to avoid the
browser showing a red X. You could accomplish this by

changing the IIS
application mappings for the ASP and ASP.NET applications

to map *.bmp to
the ASP and ASP.NET DLL's. However, this would map all

*.bmp files to
ASP/ASP.NET which would add overhead to your other *.bmp

files.

---
Side notes
* You will need to manually update the *.xyz mapping when

you update the
version of ASP.NET.

* If the end user changes the browser settings to not

display images, then
the approach of using an image tag will not work.

Similarly, not all
browsers support iframes.

* Application mappings is how IIS knows which program

should process the
requested file. HTM and image files are usually just read

from disk and
sent to the browser. For ASP and ASP.NET files, IIS calls

into the
respective DLL. Then the DLL runs its various processes

to render the file
to the browser. That's a lot more overhead.

* To set application mappings, open Internet Services

Manager, properties
for the application's folder, Directory (or Virtual

Directory) tab, click
the Configuration button, Mappings tab, look at the

existing entries to see
how to add a new entry.
---

Back to the main topic.
You could rename a single pixel *.bmp file to *.xyz.

Then, in the ASP.NET
application & ASP application respectively, map *.xyz to

ASP & ASP.NET.
Then use IIS properties for the file to add necessary

headers
(Content-Type: image/bmp and Cache-Control: no-cache).

I didn't try this,
but I think this would be a reasonable solution for you.

Before I thought of changing the extension to *.xyz, I

first came up with a
more complex idea which I did test and it worked. I don't

think it's any
better than the *.xyz idea, but here it is. At least I

tried this one and
found that it worked.

The idea is to have an ASPX page (you can convert it to

ASP) which uses
BinaryWrite to send a one pixel bitmap. The overhead of

programmatically
reading in a file to write it out seems like a lot of

overhead for this
small administrative task. So, I monitored network

activity while browsing
to a white, one pixel, monochrome bitmap file. Then I

hard coded the bytes
into my code. Since it still has to read the ASPX or ASP

file from disk,
this won't perform any better than the *.xyz approach.

Here is my sample code.

**** ASPX page
Remove everything except the @ Page declaration line.

When you do this, you will not be able to use the View In

Browser feature
of Visual Studio. You will need to manually open a

browser to view this
file.

**** Code-behind
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

Response.Buffer = True
Response.Clear()
Response.Cache.SetCacheability

(HttpCacheability.NoCache)
Response.Cache.SetExpires(#1/1/2001#)
Response.AppendHeader("Pragma", "no-Cache")
Response.ContentType = "image/bmp"

Dim b As Byte() = {66, 77, 66, 0, 0, 0, 0, 0, 0, _
0, 62, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,

_
0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0,

0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

255, _
255, 255, 0, 128, 0, 0, 0, 0, 6, 35, 65, 131, 71,

_
17, 122, 6, 195, 124, 89, 134, 189}

Response.BinaryWrite(b)
End Sub
---
Other notes

* To avoid the need to remove the HTML from the ASPX

page, you could
instead call Response.End() after BinaryWrite. However,

the whole purpose
is to trigger activity by browsing something. Therefore,

I don't want to
short-circuit the process.

* Since you mentioned this is a large ASP application and

you are just
beginning to integrate it with or convert it to ASP.NET,

I think you may
like to have more info on how to share ASP and ASP.NET

session data. You
will need to remove the page breaks in these links to use

them.

Download details: Code Sample: Session Sharing Between

Classic ASP and
ASP.NET
http://www.microsoft.com/downloads/details.aspx?
familyid=8aa45bbc-6c0b-4dcf-b7b6-

2f57e7c73587&displaylang=en

How to Share Session State Between Classic ASP and

ASP.NET (ASP.NET
Technical Articles)
http://msdn.microsoft.com/library/en-

us/dnaspp/html/converttoaspnet.asp


Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that

they visit the
http://www.microsoft.com/protect site and perform the

three straightforward
steps listed to improve your computer's security.

This posting is provided "AS IS", with no warranties, and

confers no rights.


--------------------
Content-Class: urn:content-classes:message
From: "gb" <an*******@discussions.microsoft.com>
Sender: "gb" <an*******@discussions.microsoft.com>
Subject: ASP State Integration
Date: Wed, 7 Jan 2004 22:40:50 -0800
Lines: 18
Message-ID: <07****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcPVslsMeFaQvZGfT+qbI1k6Nvzs2Q==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:200524 NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

We are in the process of upgrading part of a large system to .NET, whilst the majority will remain ASP. Sharing
session state information will not be a problem at the
moment as it is trivial and will be passed in using
QueryString.

More pressing is the synchronisation of session timeouts between the two environments. Is the only way to do this to have URL references from one environment to another. For example on the ASP pages have an .aspx reference
somewhere, or on an ASP.NET page have a .asp reference?

How would one go about doing this? Using an img src
attribute, or a hidden IFRAME element?

Thanks,

gb


.


Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.