Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 30th, 2007, 04:07 PM
Friend of Wrox
 
Join Date: Apr 2005
Location: Fort Walton Beach, FL, USA.
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default javascript and the session object

Anyone help?

Is it possible for a javascript function to get access to a page's httpcontext.current.session object?

If yes, could you show me a line of code where that is accomplished?

Thanks.

VV


  #2 (permalink)  
Old March 30th, 2007, 09:36 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Using strictly Javascript, no, I don't think so. You could, however, write a AJAX script to call some page that could return you whatever it is you are trying to get from the Session object.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #3 (permalink)  
Old March 31st, 2007, 04:10 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

VV,

Javascript runs at the client. The .NET code is running on the server. The client (web browser) could be running on a computer that doesn't even have the .NET framework. So, no, you can't do what you want strictly within javascript execution. However, as dparsons suggests you could employ Ajax techniques to call back to the server. Look at the ASP.NET Ajax Web Extensions add-on for .NET that was just released officially to market. I've worked with it a little and you might find it does what you want. A good resource for you might also be the Wrox book Beginning Ajax with ASP.NET.

-Peter
  #4 (permalink)  
Old April 1st, 2007, 02:58 PM
Friend of Wrox
 
Join Date: Apr 2005
Location: Fort Walton Beach, FL, USA.
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default

DParsons and Peter:

Thanks for the responses.

I had a suspicion that someone would suggest an AJAX approach to this problem. I say that because I have not messed with AJAX yet. Was hoping to finish this app and then
tackle AJAX. So much for my plans!

I'll just have to find another way to solve my little problem.

Thanks guys.

VV



Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript intellisense & session object VictorVictor ASP.NET 2.0 Professional 0 March 29th, 2007 10:59 AM
Session object keyvanjan Classic ASP Basics 1 January 25th, 2006 09:32 PM
Session Object mcinar Classic ASP Basics 9 January 9th, 2005 05:41 PM
Using the Session Object and JavaScript rguidry Classic ASP Professional 10 December 23rd, 2004 05:23 PM
session - javascript MartinK PHP How-To 2 November 17th, 2004 06:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.