 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 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
|
|
|
|

June 14th, 2004, 12:38 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Planoie,
Let me Explain, i have a .ascx page wherein i assign a value for my Session Variable..let us say:
Session.Add ("ssnStudentName","Twinkle");
And i have another .cs file, wherein i access the session variable, say:
string strName = (string)System.Web.HttpContext.Current.Session["ssnStudentName"];
System.Web.HttpContext.Current.Response.Write(strN ame);
This will result in a blank space without returning any value. It neither give erorr nor display the value.
Any Idea on this??
Thanks in Advance
Regards
Twinkle
|
|

June 14th, 2004, 07:32 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
No. I'm baffled. I have done this very same kind of operation myself and I have had success. Can you run this in the debugger to see that the code is working and see what's in the session? Try turning on trace for the page and look at the contents of the session collection to verify that your value is getting into the session.
|
|

June 17th, 2004, 04:34 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Planoie,
I'm sorry I was wrong. It does raises Error (as I had handled the error, I couldnât find out). When I debugged the code, I got the following errors in my immediate window
?System.Web.HttpContext.Current.Session["ssnStudentName"]
error: 'System.Web.HttpContext.Current.Session' is not an array or pointer. Indexing is not available
?(string)Session["ssnStudentName"]
error: identifier 'Session' out of scope
?(string)System.Web.HttpContext.Current.Session["ssnStudentName"]
error: 'System.Web.HttpContext.Current.Session' is not an array or pointer. Indexing is not available
?(string)context.Session["ssnStudentName"]
error: 'context.Session' is not an array or pointer. Indexing is not available
As of now I have overcome by using querysting instead of session. But Iâm very much curious to know what was the problem actually. Thank You so much for ur support
Regards,
Twinkle
|
|

June 17th, 2004, 12:55 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Ok, I realize now something that I should have caught earlier. You should try it this way:
System.Web.HttpContext.Current.Session.Items["..."]
|
|

June 18th, 2004, 07:03 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No planoie, I tried that long back..Even that didn't work, it gave a runtime error as follows
'System.Web.SessionState.HttpSessionState' does not contain a definition for 'Items'
|
|

June 18th, 2004, 08:04 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Well then I really don't know what the problem could be. Without seeing the entire picture of your code, the project and all I can't do much more.
|
|

June 23rd, 2004, 09:29 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
o.k No probs. have solved that using Querystring. Thank u so much
|
|
 |