Solved

Start a Session

Posted on 2006-11-27
7
279 Views
Last Modified: 2008-02-07
I am working in ASP.Net and want to force a Session start in a PageLoad function. Is there an easy way to do this?
0
Comment
Question by:strickdd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 18019074
Hi strickdd,

enable session for page/site and put into your PageLoad
Session["my_data"] = 'waht_ever';

Regards

!i!
0
 
LVL 28

Author Comment

by:strickdd
ID: 18019145
That would work under normal circumstances but I have session variables set in the Global.asax that I need on this page:

void Session_Start(object sender, EventArgs e)
    {
        Session["SomeSession"] = someData;
    }
0
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 18019170
Hi again strickdd,

>  want to force a Session start in a PageLoad f
so you cannt force Session start because it is already started. You could get the value as

someData = (cast_if_necessary)Session["SomeSession"];

HTH

!i!
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 28

Author Comment

by:strickdd
ID: 18019240
The session is timing out before they get to this page and getting the data does not work in this way. Therefore I have to force the session to re-start.
0
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 18019398
Hi again ivostoykov,

> enable session for page/site and put into your PageLoad
> Session["my_data"] = 'waht_ever';

then do it like this

if(Session["SomeSession"] == null){Session["SomeSession"] = someData;}
else {someData = (cast_if_necessary)Session["SomeSession"];}
HTH

!i!
0
 
LVL 28

Author Comment

by:strickdd
ID: 18020724
I would prefer to force a restart of the session at the application level. I have too many session vars set in the Session_Start event to do this to.
0
 
LVL 5

Accepted Solution

by:
prajapati84 earned 500 total points
ID: 18026427
Try this one... This will help u... (C# code)

Global g = new Global();
String str = g.Session_Start(sender, e).ToString;

For more info, refer these articles...

http://www.tek-tips.com/viewthread.cfm?qid=1301825&page=1
http://p2p.wrox.com/topic.asp?TOPIC_ID=39540

Regards,
Mukesh
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question