473,378 Members | 1,410 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,378 software developers and data experts.

Server.Transfer and Session

PJ
I'm trying to set up a front controller pattern in my web application but
having Session issues when using Server.Transfer. I have created a web
handler that processes requests for .ptv files. I have enabled default
documents for the web app and set the top entry to default.ptv and have
created blank files in all of the directories named default.ptv. The client
initially requests a page with a url like www.domain.com/admin/ and the
handler handles the request and calls context.Server.Transfer to an actual
..aspx page. However, the first call to Session in the page throws an
exception: Session state can only be used when enableSessionState is set to
true, either in a configuration file or in the Page directive.

I do not receive this error if I use context.Response.Redirect or if I
access the page directly.

The MSDN article (
http://msdn.microsoft.com/architectu...ollerInASP.asp )
on this pattern uses Server.Transfer, but the web handler is set up to
handle .aspx pages. One of the benefits I derive from the use of this
pattern is the ability to decouple the url navigation from actual .aspx
pages, so I would rather not do that.

What is the cause of this expection? Can I not use Session for non .aspx
pages even if I have a web handler to process these requests?

TIA~
PJ

Nov 19 '05 #1
2 1916
PJ,

Did you enable Session state in your handler? It's not automatic.

If you're using a Handler, you have to enable Session state by implmenting
one of these interfaces:

public class NewHandler : IHttpHandler, IRequiresSessionState

IRequiresReadOnlySessionState.

Hope this helps,

+++ Rick --
--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web
"PJ" <pj******@hotmail.com> wrote in message
news:Q6********************@speakeasy.net...
I'm trying to set up a front controller pattern in my web application but
having Session issues when using Server.Transfer. I have created a web
handler that processes requests for .ptv files. I have enabled default
documents for the web app and set the top entry to default.ptv and have
created blank files in all of the directories named default.ptv. The client initially requests a page with a url like www.domain.com/admin/ and the
handler handles the request and calls context.Server.Transfer to an actual
.aspx page. However, the first call to Session in the page throws an
exception: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive.

I do not receive this error if I use context.Response.Redirect or if I
access the page directly.

The MSDN article (
http://msdn.microsoft.com/architectu...ollerInASP.asp ) on this pattern uses Server.Transfer, but the web handler is set up to
handle .aspx pages. One of the benefits I derive from the use of this
pattern is the ability to decouple the url navigation from actual .aspx
pages, so I would rather not do that.

What is the cause of this expection? Can I not use Session for non .aspx
pages even if I have a web handler to process these requests?

TIA~
PJ

Nov 19 '05 #2
PJ
That was it...thank you.

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message
news:Or*************@tk2msftngp13.phx.gbl...
PJ,

Did you enable Session state in your handler? It's not automatic.

If you're using a Handler, you have to enable Session state by implmenting
one of these interfaces:

public class NewHandler : IHttpHandler, IRequiresSessionState

IRequiresReadOnlySessionState.

Hope this helps,

+++ Rick --
--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web
"PJ" <pj******@hotmail.com> wrote in message
news:Q6********************@speakeasy.net...
I'm trying to set up a front controller pattern in my web application but having Session issues when using Server.Transfer. I have created a web
handler that processes requests for .ptv files. I have enabled default
documents for the web app and set the top entry to default.ptv and have
created blank files in all of the directories named default.ptv. The

client
initially requests a page with a url like www.domain.com/admin/ and the
handler handles the request and calls context.Server.Transfer to an actual .aspx page. However, the first call to Session in the page throws an
exception: Session state can only be used when enableSessionState is set

to
true, either in a configuration file or in the Page directive.

I do not receive this error if I use context.Response.Redirect or if I
access the page directly.

The MSDN article (

http://msdn.microsoft.com/architectu...ollerInASP.asp )
on this pattern uses Server.Transfer, but the web handler is set up to
handle .aspx pages. One of the benefits I derive from the use of this
pattern is the ability to decouple the url navigation from actual .aspx
pages, so I would rather not do that.

What is the cause of this expection? Can I not use Session for non ..aspx pages even if I have a web handler to process these requests?

TIA~
PJ


Nov 19 '05 #3

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

Similar topics

6
by: StephenMcC | last post by:
Hi All, Got a quick query in relation to the Server.Transfer method available in IIS 5+/ASP. I've got an issue where I want to take a portion of an online app and extract this out into a web...
5
by: Tom | last post by:
Hi I am trying to transfer to a different .ASPX page using Server.Transfer. However, I get the following error: "Error executing child request for .aspx." Anyone know why? Thanks for...
1
by: Victor Song | last post by:
Hi We are trying to stream a file using server.transfer rather than response.redirect. We have it working for IIS 5.0 but IIS 6.0 refusing to let us transfer the file. If we do the less...
2
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings...
2
by: David Berman | last post by:
It seems that my site is losing session information when using Server.Transfer. I have a page called PictureGallery.aspx. It takes an argument which is an index id, so it would look like...
0
by: themattconnolly | last post by:
I have an application built on virtual pages, where the url is intercepted and a different page is built according to the url. In order to also use forms authentication, I had a Server.Transfer...
10
by: GreggTB | last post by:
I've got an page (LOGIN.ASPX) that receives the user's login information. During the page load, it checks the credentials against a database and, if validation is successful, creates an instance of...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
23
by: barryfz | last post by:
I need to be able to move from one web app on my server to another on the same server and preserve the session state. I have played with server.transfer but I get an error saying I can't do this....
0
Frinavale
by: Frinavale | last post by:
Platform: WindowsXP and IIS Language: Asp .NET (using Visual Basic back end) I'm not sure if anyone will be able to understand my code because its written using ASPX and Visual Basic back end. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.