Click here to Skip to main content
15,901,373 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHelp with refactoring [modified] Pin
But_Im_a_Lady8-Jun-07 2:59
But_Im_a_Lady8-Jun-07 2:59 
AnswerRe: Help with refactoring Pin
But_Im_a_Lady8-Jun-07 3:14
But_Im_a_Lady8-Jun-07 3:14 
QuestionHow to create and use assemblies in .net? Pin
softengg1238-Jun-07 2:40
softengg1238-Jun-07 2:40 
AnswerRe: How to create and use assemblies in .net? Pin
Manas Bhardwaj8-Jun-07 3:04
professionalManas Bhardwaj8-Jun-07 3:04 
AnswerRe: How to create and use assemblies in .net? Pin
Nouman Bhatti8-Jun-07 3:18
Nouman Bhatti8-Jun-07 3:18 
AnswerRe: How to create and use assemblies in .net? Pin
Sandeep Akhare8-Jun-07 4:26
Sandeep Akhare8-Jun-07 4:26 
GeneralRe: How to create and use assemblies in .net? Pin
softengg1238-Jun-07 18:19
softengg1238-Jun-07 18:19 
QuestionHow to access session using the instance of another page? Pin
Ashokkuma8-Jun-07 2:10
Ashokkuma8-Jun-07 2:10 
I have three pages: First.ascx, Second.ascx and Third.ascx

In First.ascx, im setting a session variable to some value
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Session("xyz")="SomeValue"
End Sub

In Second.ascx, i have a function to access the session value

Public Function RetrieveFromSession() As String
Dim str As String
str=Session("xyz")
return str
End Function

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SessionValue As String
SessionValue = RetrieveFromSession()
End Sub
This is working perfectly fine. Im able to access the session this way.



But in Third.ascx, im creating an instance for Second

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objSecond As New Second()
Dim strSessionValue As String
strSessionValue = objSecond.RetrieveFromSession()
End Sub
The function RetrieveFromSession() is called properly, but inside the function

the line str=Session("xyz") goes to error. It says "Object reference not set to an instance of an object."

But, im able to access the session directly. ie.,

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strSessionValue As String
strSessionValue = Session("xyz")
End Sub
This is working fine.


But, i want third.ascx to access the session using objSecond.RetrieveFromSession() function.

How can this be rectified.

Can anybody help me in this regard???




Ashokkuma
AnswerRe: How to access session using the instance of another page? Pin
Chetan Ranpariya8-Jun-07 2:42
Chetan Ranpariya8-Jun-07 2:42 
GeneralRe: How to access session using the instance of another page? Pin
Ashokkuma8-Jun-07 2:55
Ashokkuma8-Jun-07 2:55 
GeneralRe: How to access session using the instance of another page? Pin
Paddy Boyd8-Jun-07 3:15
Paddy Boyd8-Jun-07 3:15 
GeneralRe: How to access session using the instance of another page? Pin
Nouman Bhatti8-Jun-07 3:23
Nouman Bhatti8-Jun-07 3:23 
AnswerRe: How to access session using the instance of another page? Pin
Guffa8-Jun-07 8:24
Guffa8-Jun-07 8:24 
GeneralRe: How to access session using the instance of another page? Pin
Ashokkuma10-Jun-07 21:39
Ashokkuma10-Jun-07 21:39 
QuestionData formatting expression in Datagrid........................ Pin
Member 38798818-Jun-07 1:56
Member 38798818-Jun-07 1:56 
AnswerRe: Data formatting expression in Datagrid........................ Pin
Nouman Bhatti8-Jun-07 3:24
Nouman Bhatti8-Jun-07 3:24 
Questionhow to get the xml from dataset Pin
sooreeagt8-Jun-07 1:12
sooreeagt8-Jun-07 1:12 
AnswerRe: how to get the xml from dataset Pin
Sylvester george8-Jun-07 1:35
Sylvester george8-Jun-07 1:35 
AnswerRe: how to get the xml from dataset Pin
Nouman Bhatti8-Jun-07 3:29
Nouman Bhatti8-Jun-07 3:29 
Questionopenenig document in different window Pin
Sandeep Akhare8-Jun-07 0:14
Sandeep Akhare8-Jun-07 0:14 
AnswerRe: openenig document in different window [modified] Pin
Chetan Ranpariya8-Jun-07 0:22
Chetan Ranpariya8-Jun-07 0:22 
GeneralRe: openenig document in different window Pin
Sandeep Akhare8-Jun-07 0:41
Sandeep Akhare8-Jun-07 0:41 
GeneralRe: openenig document in different window Pin
Chetan Ranpariya8-Jun-07 0:58
Chetan Ranpariya8-Jun-07 0:58 
AnswerRe: openenig document in different window Pin
badgrs8-Jun-07 0:22
badgrs8-Jun-07 0:22 
AnswerRe: openenig document in different window [modified] Pin
Tom John8-Jun-07 0:24
Tom John8-Jun-07 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.