473,804 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 enableSessionSt ate is set to
true, either in a configuration file or in the Page directive.

I do not receive this error if I use context.Respons e.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 1938
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, IRequiresSessio nState

IRequiresReadOn lySessionState.

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******@hotma il.com> wrote in message
news:Q6******** ************@sp eakeasy.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 enableSessionSt ate is set to true, either in a configuration file or in the Page directive.

I do not receive this error if I use context.Respons e.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********@hot mail.com> wrote in message
news:Or******** *****@tk2msftng p13.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, IRequiresSessio nState

IRequiresReadOn lySessionState.

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******@hotma il.com> wrote in message
news:Q6******** ************@sp eakeasy.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 enableSessionSt ate is set

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

I do not receive this error if I use context.Respons e.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
2242
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 site on its own, so I will end up having two web sites. This planned to aid problems we've been having with performance, as if the portion (which is an app in its own right) has problems we then have to restart the whole site and so bring everything...
5
7411
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 help.
1
3501
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 efficient prompt/response technique to the browser both work fine. We found this article that was only slightly appicable (ms-help://MS.MSDNQTR.2004APR.1033/enu_kbiis/iis/326965.ht kb 326965 ) but since csv is already a defined mime type this shouldn't...
2
3382
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 for the web site are held in a database and all the labels, buttons etc are populated at run time in the Page_Load handler. The retreval of the strings from the database is all
2
3767
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 PictureGallery.aspx?id=30 to display gallery 30. In this way I have a database driven picture gallery. To improve indexing, I put code in Global.asax to allow me to get to the same page with a url like this: Pictures_30.aspx. There is no...
0
1941
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 call in a custom HttpModule, called by AuthenticateRequest. The problem is that now I want to access session variables that are set on the application's start, but calling Server.Transfer inside of AuthenticateRequest loses reference to the session....
10
12213
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 an object that stores the user's basic profile data (username, user type, associated sales region, etc.). I've been taking this user info and placing it in the Session object like so... Session = user;
6
3811
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 one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
23
6812
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. How can I accomplish this. I don't think redirects with session state being passed in the url makes any sense from a security standpoint. -- Barry
0
1617
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. My problem is mostly understanding the ASP part and Server.Transfer oddities I'm experiencing. I have posted before about this project's problems but since I have recoded everything to implement Server.Transfer, figured its probably best to start a...
0
9707
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9585
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.