State Management :: Looking For A Way to Declare A Global Variable?

May 14, 2010

I'm looking for a way to declare a global variable (so all pages could see) but personal (so if one user puts some value in it, it won't matter to another user or change his value).Sessions and hidden fields won't do. I've tried working with declaring keys in Web.config but unfortunely, the keys values aren't personal, and all users share the same key value.Another way I was thinking was maybe classes, but perhaps there might be an easier solution?

View 19 Replies


Similar Messages:

State Management :: Declare A Variable In Page Load{} As Global?

Jan 2, 2011

i want to declare a variable in page load{} as global so that i can monitor it so that it is not recreated each time

View 4 Replies

State Management :: How To Define A Global Variable In A Page

Oct 31, 2010

I have to define a global and unchangeable variable in a web page. I used static variable but its content is the same for all users that use the page and it is bad. I dont want use Session variable.

View 5 Replies

State Management :: Keeping Application Variable Or Static Class For Global String?

Nov 18, 2010

I need to keep a global variable throughout the whole time the user is at my site, but do I use Application or a static class? The string variable should store a region name and my site makes a few changes depending on which region that has been set.

I read that Application was mainly for classic ASP, but I also read that a static class cannot be instantiated at runtime (e.g. when the user has logged in).

So, have I got something wrong here and which solution do I use?

View 2 Replies

State Management :: Make A Global Variable Counter That Adjust In Code In The Webforms?

Jun 23, 2010

Not sure if this was the forum to post under but here goes. I want to make a global variable counter that I can adjust in my code in the webforms. For example, I want to use the counter like so...

[Code]....

If anyone knows how to create this dynamic global variable or if anyone can tell me if its not possible,If it is not possible,

View 3 Replies

C# - How To Declare A Global Variable In MVC Page

Jun 4, 2010

I've began working with asp.net mvc very recently and I've ran into a problem.I've got an aspx page which renders a few ascx pages. What I'd like to do is declare a global var at the aspx page so it is visible to all its childs. I tried <% var i = 0; %> but it wasn't visible at the child pages. What could I do?

View 4 Replies

Web Forms :: How To Declare A Global Variable That Can Be Used Within A User

May 15, 2010

I would like know how to declare a global variable that can be used within a user after the user login and before the user logout across all the possible pages.

I need to develop a web application that will connect to 5 different servers depends on the selection of user on what server they wish to connect and after they select a server and login...I will need to keep track the server name in a variable last until the user logout (user may visit various pages but the server name MUST NOT be changed due to other user login into different server). So how can I do it so that other users may select different servers and will keep the server name for each different users.

Let says:-

User A selects Server A and login and User B selects Server B and login at the same time, so how the global variable can handle the needs for each user (User A & B) with different server select?

Is "Session" the only way to fulfill the above? I think of using Application State but it seems that the value stored will be shared by all users and not for a particular user.

View 1 Replies

How To Declare A GLOBAL Variable An Aspx Website

Aug 26, 2010

How to declare a global variable or a public sub in a web application that all aspx pages can have access to?

View 5 Replies

Web Forms :: Declare Global Variable In Master Page And Use It In Content Pages

Jun 16, 2015

how to declare global variable in master page and use it in all pages

View 1 Replies

State Management :: Global.asax To Load Up Several Session Variable When A Session Starts?

Sep 14, 2010

I added the following code to global.asax to load up several session variable when a session starts. I'm assuming that when a page goes to use the variable that I should be

1) checking at the page level that the value is valid not 0 when its not expected to be 0, not a zero-length string when its expected to have a length

2) have code at the page level that sets the values if the values have not been set as when the Session timeout, ideally putting the code in a class derived from Page and then deriving all of my pages from the new class so that the code does not have to be repeated in every page

[Code]....

View 7 Replies

JQuery :: Grab A Global Variable Or Session Or View State Variable In The Javascript?

Dec 9, 2010

can we grab a global variable or Session or View State variable in the javascript or using jquery?

View 2 Replies

State Management :: Losing Session State In Global.asax File?

Feb 2, 2011

I am trying to set a session variable in the global.asax file and keep running into the problem that the Session is null.

I am running my application in VS2008 and using asp.net 3.51.

Here is my code:

1. In my web.config file I have enabled the session state and added the following line;

<sessionState
cookieless="false"
mode="InProc"
timeout="60"
></sessionState>

2. In the Session_Start procedure in the Global.asax file I set the session variable to a default value.

[Code]....

My problem seems to be that when the Application_Error procedure is executed the session state is lost.

Does anyone know why the session state isn't available in the Global.asax file.

View 9 Replies

State Management :: Public Variable Vs Session Variable To Store Logged In UserID

May 17, 2010

I have a web application which uses a session variable to store the logged in userid. If no user is logged in, of course this variable will be empty and the contents displayed on my website are meant for guests. If there is a user logged in, the user specific controls/access/links will then be a displayed.

I am now having issues with my hosting where on shared application pool, the worker recycle is triggered every 90 minutes, this will clear sessions causing all my users to be logged out. I opted for a dedicated application pool, which got worse because I am only allocated 50MB memory limit and if this is reached, the worker recycle is triggered and I lose my sessions again. I have tried as much as possible optimization techniques, e.g. dispose where possible, close connections, disable viewstate for static controls etc but my memory per instance keeps building up from page to page without any signs of improvement. I don't use loops nor store huge objects like bitmaps etc but my sessions are now gone even faster than 90 minutes in shared application pool before.

I have considered using SQL Session State but there isn't a simple guide on using this with MySQL. I am getting desperate and considering using a public variable, a string as a replacement to store logged in user id instead of in a session variable. I am pretty sure this will solve my issue with sessions being recycled but are there any negative consequences of doing this? One problem I can think of is if the user closes the browser, the system will never know that the user is now logged out and this public variable should be nothing. In this scenario, will the GC eventually clear this abandoned public variable.

View 10 Replies

State Management :: Session Variable Authentication State Timeout?

Dec 3, 2010

I am building a web app that is limited to one database, therefore I cannot use the ASP.NET config tool. As a quick means of getting this app online, I tried to use a simple session variable. The login page verifies the user's credentials, and if they pass, it sets the session variable to a certain value. All other pages check in the page_load event whether or not the session variable is equal to that value. The problem is that once being logged in for a short while and sending and recieving some data, the session variable resets, and I'm returned to the login page to repeat the process. Here's the basic code from my webforms:

[code]....

Is there some setting I need to change in the web.config file to adjust the cookie timeout or is that only for the config tool authentication methods?

View 5 Replies

State Management :: Get Session In Global.asax?

Mar 20, 2010

how to get sessions in the global.asax, but I still cant get it to work...for some reason my session throws NullExceptions..the sessions are set from another page add looks something like:

[Code]....

And once I try to get those session values I do the following in the Global.asax:

[Code]....

But as I said, for some reason I get a NullException once I try to get the values...and they do have the same session-name,so they shouldn't be null..

View 6 Replies

State Management :: Is There Other Than Session To Store Global Values

May 21, 2010

I want to use something better thatn using the session to store global values, because it has somw problems

View 4 Replies

State Management :: Maintain Session Using Global.asax?

Dec 20, 2010

i dont know about Global.asax so give some information about it and also tell me about the implementation and use of session_start and session_end event. How to call Global.asax in our website.

View 5 Replies

State Management :: Handle Session_end Out Of Global.asax?

Nov 11, 2010

i'm using asp.net 2.0.

there's a way to add an handler to manage the session_end event without using the global.asax?

(i can't modify my httpapplication code so i need to add the handler externally to it)

View 2 Replies

State Management :: Get Session Value In Global.asax Page?

Apr 6, 2010

When i start the application, based on some condition in global.asax page,i wil redirect to login page.If i click the logout button,

there i vil be clear all session value. here i want to initiate new session value like Session["InitialLogin"]="Yes".

How can i get this value in global .asax page. If get that session value [i.e Session["InitialLogin"]="Yes"], i vil redirect to some other page.

I cant able to get session value in global.asax page.i always getting null value.

View 7 Replies

State Management :: PostBack Triggers Session_Start On Global.asax

Oct 6, 2010

I have a simple aspx Page, which html contains:

[Code]....

and code behind:

[Code]....

This is quite simple. When I press btn1, it sets correctly the Session Key. And this is then the issue arrives: When I press one of these buttons, this is the sequence of what happens:

Global.asax: Session_Start
MyPage.aspx: Page_Load » btnX_Click

So, everytime there is a PostBack, even before the Page loads, the session starts and generates a new Id. This way, I loose everything during the PostBack. My Session State configuration:

[Code]....

This is running on VS 2010 + V3.5, on IIS5.1. The Page header configuration is default.

View 6 Replies

State Management :: Want To Access Url In Application_start Event In Global.asax?

Dec 1, 2010

Suppose my website address is like http://localhost/MyWebsite

I wanted to access this url in Application_start event in global.asax, Can i some how get it?

[I know i can get it via application_beginrequest or other event]

View 17 Replies

State Management :: Difference Between Global_ Vs Application_ In Global.asax?

May 23, 2010

What is the difference between the 2? Ex:

Private Sub Globals_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.BeginRequest

vs

Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)

View 3 Replies

State Management :: Using Global.asax To Set Session Variables Pulled From SQLServer?

Sep 3, 2010

I have a custom class that pulls user information from a SQL Server table. Now that I'm expanding the site from a single page to others. I want to shift the code to the Session_Start event so that the information is always loaded when the site is accessed. How do I call my custom code from global.asax since its script and not a class.

View 5 Replies

State Management :: How To Apply Session Globally In A Website Using Global.asax File

Jan 4, 2011

how can I implement a Global Session in my ASP.NET 3.5 website in C# using Global.asax file ?

View 18 Replies

State Management :: Will Sessions Kill When Application Error Occurs Which Is In Global.aspx

Sep 29, 2010

can you tell Will sessions kill when application error occurs which is in global.aspx ?

ex:

[code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved