This is a migrated thread and some comments may be shown as answers.

Issue with PageMethods when following best practices in a web app

3 Answers 92 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Josh
Top achievements
Rank 1
Josh asked on 26 May 2009, 01:02 PM
Hi,

I have been setting up a web application with Open Access and I have been very happy with the product.  I was following the best practices by using an HTTP module for containing the ObjectScope and I have run into an issue.  When following this,  I am not seeing the HTTP module's PreRequestHandlerExecute method being invoked when calling PageMethods from an ASP.Net page.  This means that the ObjectScope is not available in the session when running code through the PageMethod.  I am running this solution under VS 2008 and using the development web server that ships with it.  At first I thought it might be the fact that the url is http://localhost/mypage.aspx/<pagemethod name> and it is not treating it exactly like an ASPX page but everything I have read said that The development server should route all requests through the asp.net pipeline.  If needed, I can send you a quick sample project showing the behavior.

Do you have any suggestions on how to work around this? 

Thanks!

3 Answers, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 28 May 2009, 03:36 PM
Hi Jim,
Just instantiate the ObjectScope where you need it, wherever you use it and it is still null retreive one. Add the check to the scope. Dispose() call as well.

All the best,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Josh
Top achievements
Rank 1
answered on 01 Jun 2009, 01:41 AM
Thanks for the answer.  We ended up setting up our scope object in a different manner than in your web application examples.  It turns out that when using a REST based call, as used with page methods, the ASP.net runtime will short circuit the page life cycle and the PreRequestHandlerExecute method in my custom HTTP module never gets called.


0
Zoran
Telerik team
answered on 05 Jun 2009, 06:55 AM
Hello Jim,

Yes, there are issues in some scenarios in the HttpModule way of object-scope management. Have you considered the latest approach, using the HttpContext.Items collection that we have described in our latest KB article. It has so far proven to be very convenient for every web-scenario where master-pages way of obtaining the object scope is not proffered or applicable.

All the best,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Josh
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Josh
Top achievements
Rank 1
Zoran
Telerik team
Share this question
or