Showing posts with label aspnet. Show all posts
Showing posts with label aspnet. Show all posts

Saturday, March 31, 2012

Session tracked via URL in ASP.NET

Hello,

I have my asp.net web application to track session id across pages using the url, and not cookies, ie in the web.config file:
<sessionState .... cookieless="true" ...... />

however each link in the page does not embed the id in the url like it is supposed to :

<a href="http://links.10026.com/?link=http://mywebserver/(rqe4ptb333ojxz3kh1t3xqr3)/mypage.aspx"> my link </a>

and so each page i travel to, a new session id is created in the url and the information associated with the previous page's session id is lost.

can anybody tell me what else i need to do to make this work?

thank you,

Kenton Taylorfor some reason the .net framework will not insert the session id before rendering the HTML if your HREF uses a "/" to denote that the path is relative to the root

this will work:
href="http://myserver/home.aspx"

as will this:
href="home.aspx"

but this won't:
href="/home.aspx"

Thursday, March 29, 2012

session varaibles with asp.net urgent help

hi i store some value in session object and later try to access it but the
value return from session variable is null
like
Session["Myname"]=txtmyname.Text;
Session["Age"]=txtAge.Text;
Response.Redirect("Welcome.aspx");
when this page loaded and iin page load event i called
lblMyname.Text=(string)session["Myname"];
lblAge.Text=(string)session["Age"];
it return null value instead of actual values.
i tried to store session value both in sql database and local memory both
result are sameamjad wrote:

Quote:

Originally Posted by

hi i store some value in session object and later try to access it but the
value return from session variable is null
like
Session["Myname"]=txtmyname.Text;
Session["Age"]=txtAge.Text;
Response.Redirect("Welcome.aspx");
when this page loaded and iin page load event i called
lblMyname.Text=(string)session["Myname"];
lblAge.Text=(string)session["Age"];
it return null value instead of actual values.
i tried to store session value both in sql database and local memory both
result are same


The possible chances are these:
1. you have started session somewhere else (on anyother page) as well
and
session is not abondened yet (with session.abonden).

2.

Quote:

Originally Posted by

lblMyname.Text=(string)session["Myname"]; //session's s should be capital i.e Session


3. or try this instead

lblMyname.Text=Session["email"].ToString();
3.
lblAge.Text=Session["Age"].ToString()
its not the Session i wrote small otherwise c # cannot compile. . i have
cancelled the session variable but still cannt display that value in another
page.

"nasirmajor@.yahoo.com" wrote:

Quote:

Originally Posted by

>
amjad wrote:

Quote:

Originally Posted by

hi i store some value in session object and later try to access it but the
value return from session variable is null
like
Session["Myname"]=txtmyname.Text;
Session["Age"]=txtAge.Text;
Response.Redirect("Welcome.aspx");
when this page loaded and iin page load event i called
lblMyname.Text=(string)session["Myname"];
lblAge.Text=(string)session["Age"];
it return null value instead of actual values.
i tried to store session value both in sql database and local memory both
result are same


>
The possible chances are these:
1. you have started session somewhere else (on anyother page) as well
and
session is not abondened yet (with session.abonden).
>
2.

Quote:

Originally Posted by

lblMyname.Text=(string)session["Myname"]; //session's s should be capital i.e Session


>
>
3. or try this instead
>
lblMyname.Text=Session["email"].ToString();
>
>


where have you cancelled/cleared the session?
when i do that instead of (string)Session["Age"] then it gave me that error
System.NullReferenceException: Object reference not set to an instance of an
object.

"nasirmajor@.yahoo.com" wrote:

Quote:

Originally Posted by

>
3.
lblAge.Text=Session["Age"].ToString()
>
>


amjad wrote:

Quote:

Originally Posted by

when i do that instead of (string)Session["Age"] then it gave me that error
System.NullReferenceException: Object reference not set to an instance of an
object.
>
>
"nasirmajor@.yahoo.com" wrote:
>

Quote:

Originally Posted by


3.
lblAge.Text=Session["Age"].ToString()


where ever if you have used session.clear or session.removeall replace
it with
session.abondon();
try whats happen?

Monday, March 26, 2012

Session variable is lost between ASP & ASP.NET pages

Hi folks,
I must be missing something here. I have an ASP page that I create a
Session variable in as follows.
Session ("name")="Joe"
In an ASP.NET page in the same project and the same session, I call the
Session variable as follows:
Dim str As String
str = Session("name")
When I do a Response.Write (str), nothing writes to the screen.
Any thoughts on what is happening here would be appreciatedUhhhh...
Yeah , that is what it will do. It doesn't work like that.
You can check this out
http://www.asp101.com/articles/sidn...ate/default.asp
but ... the thing surprising you, isn't surprising at all. They are
different technologies...
with nothing but the phrase "asp" in common.
"glenn" <glenn@.discussions.microsoft.com> wrote in message
news:16EE097D-5F1E-4742-AB89-E05057E59EA0@.microsoft.com...
> Hi folks,
> I must be missing something here. I have an ASP page that I create a
> Session variable in as follows.
> Session ("name")="Joe"
> In an ASP.NET page in the same project and the same session, I call the
> Session variable as follows:
> Dim str As String
> str = Session("name")
> When I do a Response.Write (str), nothing writes to the screen.
> Any thoughts on what is happening here would be appreciated
re:
>nothing but the phrase "asp" in common
Absolutely...
The seminal work on sharing session state between ASP and ASP.NET is :
"How to Share Session State Between Classic ASP and ASP.NET"
http://msdn.microsoft.com/library/d...
rttoaspnet.asp
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"sloan" <sloan@.ipass.net> wrote in message news:%23zLsJArUGHA.1160@.TK2MSFTNGP09.phx.gbl...[
color=darkred]
> Uhhhh...
> Yeah , that is what it will do. It doesn't work like that.
> You can check this out
> http://www.asp101.com/articles/sidn...ate/default.asp
> but ... the thing surprising you, isn't surprising at all. They are
> different technologies...with nothing but the phrase "asp" in common.
>
>
> "glenn" <glenn@.discussions.microsoft.com> wrote in message
> news:16EE097D-5F1E-4742-AB89-E05057E59EA0@.microsoft.com...
>[/color]

Session variable is lost between ASP & ASP.NET pages

Hi folks,

I must be missing something here. I have an ASP page that I create a
Session variable in as follows.

Session ("name")="Joe"

In an ASP.NET page in the same project and the same session, I call the
Session variable as follows:

Dim str As String
str = Session("name")

When I do a Response.Write (str), nothing writes to the screen.

Any thoughts on what is happening here would be appreciatedUhhhh...

Yeah , that is what it will do. It doesn't work like that.

You can check this out
http://www.asp101.com/articles/sidn...ate/default.asp

but ... the thing surprising you, isn't surprising at all. They are
different technologies...
with nothing but the phrase "asp" in common.

"glenn" <glenn@.discussions.microsoft.com> wrote in message
news:16EE097D-5F1E-4742-AB89-E05057E59EA0@.microsoft.com...
> Hi folks,
> I must be missing something here. I have an ASP page that I create a
> Session variable in as follows.
> Session ("name")="Joe"
> In an ASP.NET page in the same project and the same session, I call the
> Session variable as follows:
> Dim str As String
> str = Session("name")
> When I do a Response.Write (str), nothing writes to the screen.
> Any thoughts on what is happening here would be appreciated
re:
>nothing but the phrase "asp" in common

Absolutely...

The seminal work on sharing session state between ASP and ASP.NET is :

"How to Share Session State Between Classic ASP and ASP.NET"
http://msdn.microsoft.com/library/d...erttoaspnet.asp

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"sloan" <sloan@.ipass.net> wrote in message news:%23zLsJArUGHA.1160@.TK2MSFTNGP09.phx.gbl...
> Uhhhh...
> Yeah , that is what it will do. It doesn't work like that.
> You can check this out
> http://www.asp101.com/articles/sidn...ate/default.asp
> but ... the thing surprising you, isn't surprising at all. They are
> different technologies...with nothing but the phrase "asp" in common.
>
>
> "glenn" <glenn@.discussions.microsoft.com> wrote in message
> news:16EE097D-5F1E-4742-AB89-E05057E59EA0@.microsoft.com...
>> Hi folks,
>>
>> I must be missing something here. I have an ASP page that I create a
>> Session variable in as follows.
>>
>> Session ("name")="Joe"
>>
>> In an ASP.NET page in the same project and the same session, I call the
>> Session variable as follows:
>>
>> Dim str As String
>> str = Session("name")
>>
>> When I do a Response.Write (str), nothing writes to the screen.
>>
>> Any thoughts on what is happening here would be appreciated