C# - Static Behave / Only Work For A Specific User Session Or For Overall Application?

Mar 1, 2011

I have an asp.net application with c# language. I have a common class which maintain the constants and static variables and fields. I also have a login page. If the user logs in successful I set IsLoggedInSuccessfull as a static boolean variable in common class.

My question is: Will this only work for a specific user session or for overall application ?

Based on some answers I got another question here.

let say i am using the Static method as Authenticate(User objUser). intention is to call this method when user clicked log in button. where on login button I am let say prepare the User object with certain parameters required for login, then passing to this method. what would be the impact there? let say I have single server for now (no server farm or garden). then there will be the single application level method to authenticate the user, right? and say 10000 user are going to logging in to this site/application then how authenticate() method comes in behaves ? will CLR automatically manage threading there ?

View 5 Replies

Similar Messages:

Working With Static Variables / Store The User Specific Information In Static Variables?

Mar 5, 2011

whats the exact use of static variables in overall programming in .net and for asp.net...

Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..

whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash.

View 3 Replies

C# - Is It Safe To Access .net Session Variables Through Static Properties Of A Static Object

May 10, 2010

Is it safe to access asp.net session variables through static properties of a static object?Here is what I mean:

public static class SessionHelper
public static int Age

Is it possible that userA could access userB's session data this way?

View 2 Replies

Session Object Not Work With Combined Mvc And Webform Application?

Jan 21, 2010

Environment used - Asp.net mvc 1.0 with c#

Problem -I have used simple mvc application. and also added webform into mvc application.and it is working fine. but when i used session object for sharing data between mvc and webapplication. it is not working. I have put Session["logon"] = "logon"; object into mvc controller and when i access this into webform then there is no value in session object.

View 2 Replies

Does Static Reference To HttpContext.Current.Session Return Same Session For All Users

Feb 4, 2011

Is there room for issue in the following code in terms of multiple users of the same web application? I mean, I know that a purely static string will be shared across all sessions for a single ASP.NET application, but since this explicitly refers to the Current.Session, even though it is static it seems like it would always refer to the session instance of the "current user." But an error is happening that could be explained by everyone sharing the current value of Mode and thus the most recent change overwriting everyone else's mode value. (As a background: This string is in a Helpers class that is used throughout the application. I do not want to make references to Session["Mode"] throughout the application and do not want to have to pass Session["Mode"] in every method call from an aspx.cs page.)

public static string Mode
var value = HttpContext.Current.Session["Mode"];
return (value ?? string.Empty).ToString();
HttpContext.Current.Session["Mode"] = value;

View 2 Replies

MVC :: Put View-specific Static Content (img/js)?

May 26, 2010

so I see these opinions/tutorials about serving static content to support views, from files that co-reside in directories with those views:http://forums.asp.net/p/1258895/2347379.aspx#2347379http://haacked.com/archive/2008/06/25/aspnetmvc-block-view-access.aspxIn the second article, Phil says view-adjacent static content was default-enabled at the time (over a year ago). Unfortunately, though, I reference:


and by default ASP.NET is trying to find it adjacent to my view, which (voila!) is disabled by default. Grr. :)What is the out-of-box IDE-assisted way to reference view-specific static content that doesn't require hardcoding directory tree structures into my path, and also doesn't require ALL of my assets to be in a single folder?Or, if I do it the "unpure" way like I'll probably do if I don't get other ideas (by modifying /Views/Web.Config HttpFileNotFoundHandler), should I block anything unsafe besides .ASCX, .ASPX, and .MASTER that is likely to show up in my views folder?

View 8 Replies

Vb.net - Architecture Specific To Shared/Static Functions?

Apr 30, 2010

If for example you have a function Public shared function GetStockByID(StockID as Guid) as Stock Is that function common to all current users of your application? Or is the shared function only specific to the current user and shared in the context of ONLY that current user? So more specifically my question is this, besides database concurrency issues such as table locking do I need to concern myself with threading issues in shared functions in an ASP.Net application?In my head; let's say my application namespace is MyTestApplicationNamespace. Everytime a new user connects to my site a new instance of the MyTestApplicationNamespace is created and therefore all shared functions are common to that instance and user but NOT common across multiple users. Is this correct?

View 2 Replies

Security :: Associate A Specific User To A Specific Data On The Site?

Mar 14, 2010

I am trying to figure out how to associate a specific user to a specific data on the site, like social networking site.

View 3 Replies

Security :: Maintain Session For Multi User Application?

Oct 25, 2010

I am developing a web application. This application is fully customised based on the user settings. Suppose, application hosted on [URL] and user can signup on the website and it will get the domain like [URL] and for user2 will be [URL] so and so forth. so in this case how would I maintain the session for each user? each user will be representing a single website along with public interface and admin pages.

what I am thinking is to store all the setting (for each user) in the database and then when ever server received request then get the user info from the URL (first time only and after get it from the session) and get user details but I am not very much satisfied with this approach.

View 5 Replies

Java - Alternative For User Session In High Traffic Web Application?

Feb 7, 2011

What would be good/scalable user session alternative in following scenario:

users don't have to have cookies enabled URL query string restriction of 255 characters is imposed lot of GET requests (no hidden form fields)application runs on serveral servers (web farm) some users connect over proxy (same IP) users connect over HTTPS 50 000 concurrent users

View 5 Replies

Security :: End Specific Session Outside The Current Session?

May 20, 2010

I would like to check if someone tries to access the application with the same username from a different browser/pc/etc. All usernames and passwords are stored in a MSSQL db.

What I am doing at the moment is: In the global.asax-file in Application_start(..) I initialize [Code]....

Now with every user that logs in I can check whether he is allready in ( in that case, he won't be able to log in, he'll be redirected to the login page ). Let's say it's the same user who wants to login but for some reason he wants to start the application from a different pc, maybe in a different building. Unless he hasn't forget to logout, he won't be able to login on this different computer. So he would has to go back and logout or wait for the timeout.

Now wouldn't it be more convenient to abandon the first session and let the same user login to the pc where he is right now?

The question is, is it possible to end the first session without beeing in it? Or is there any other solution for that problem? Since I have the SessionID stored in Application["UserList"] is there any possibility to end that specific session?

View 3 Replies

Web Forms :: Once The User Is Successfully Logged Into Application Want To Change The Session.sessionid New?

Dec 26, 2010

i want to generate the new sessionid in the same httpcontext once the user is successfully authenticated.so, how can i do that ? ( please dont ask why do you want it, i got such kind of requirement).

View 3 Replies

Static Compression In IIS Does Not Work For Htm And Js Files

Apr 1, 2011

I'm trying to configure IIS 7.5 to compress static htm and js files. Here is my web.config for the web site:


Compression starts working when I set doDynamicCompression to true. But I can't use this option because it is disabled at my hosting.

View 2 Replies

C# - Where Does Static Variable Work In Page

Apr 26, 2010

I had an interview today and every thing was going very good, but then an interviewer asked me a question Where Does Static Variable Work in C#- At Application Level or At Page Level.I was not very much clear about this answer as I only knew that static variables are stored on heap and I didn't knew anything about web related thing.

Then he tried to make me more clear by giving an example that in a page I am using static variable and three users are accessing the page one of the user updates the value of static variable, What value will be visible to remaining two users an old copy or the update will be reflected.

View 3 Replies

Static Properties Work In C# Environment?

Oct 26, 2010

If I had a class with a static property that is set when a user loads a particular page, is that static value unique to that users session?

In other words, if a second user then loads the page and sets the static property, will each user have a distinct value, or will both use the second users value?

View 3 Replies

State Management :: Handle Session End Event For Web Application When User Closes His Browser?

Oct 20, 2010

I need to handle "session end" event for my web application when user closes his browser. Session is stored in Sql.

View 6 Replies

Web Forms :: Store Value Without Session - Static

Jan 21, 2010

I am currently working on asp.net 3.5 with C#. In our application Link buttons are used in Grid to redirect page. means when user click on link from Home Page it will redirect to Job details and when user click on Job details link grid it will redirect to VehicleDetail page. My problem is how to store value on jobDetails page from which page user came. without using Session , Static variable when page is redirect.

View 5 Replies

AJAX :: Calling Static Play Method Doesn't Work?

Aug 26, 2010

I have a page with an update contentpanel, with 4 panels inside. Image buttons outside the update panel control control which panel is visible. I am trying to call an animation from a javascript function, but the animation doesn't work, everything else does.







View 10 Replies

Web Forms :: How To Access Session In Static Methods

Sep 15, 2010

I write a simple static method in my web page. How can i access session["id"] into method? I dont have access.For example:

public static void myFunc()
Session["id"]= 100;

View 2 Replies

How To HttpContext.Current Work, Providing Context Appropriate State Off A Static Variable

Mar 31, 2010

I've always wondered how you can access the correct state of the current http context via a static method:

HttpContext.Current.Session["foo"] = "bar";

In any other program, anywhere else, my initial assumption about working with a static accessor like this is that changing it will change it across all threads. Similarly, another thread running my change it on me while I am trying to use it.But HttpContext.Current does not behave like this. It provides the appropriate state for the given request, even through the static accessor.

View 3 Replies

Data Controls :: DatePicker Inside GridView Does Not Work When ClientIDMode Is Set To Static

Jun 16, 2015

i have tired your demo 


but   this is not working  change your  code 

<asp:TextBox ID="txtProductDate" ClientIDMode="Static" runat="server" ReadOnly = "true"></asp:TextBox>

it is always updating values to first datepicker 

View 1 Replies

Which One Should Use For "anonymous User Identity" - "specific User: IUSR" Or "application Pool Identity"?

Feb 2, 2011

In IIS Manager center pane, there is an icon titled "Authentication" as follows: Clicking the icon, we get 3 items as follows: Right clicking the Anonymous Authentication and select edit, we have: Question: which one should I use? What is the difference?

View 3 Replies

Why Nothing Behave Differently Between RDL And RDLC

Feb 12, 2010

Why IsNothing() is behave differently between RDL and RDLC? I was trying to create a report (RDLC) in VS 2008 and using the IsNothing() function to check to NULL value, however, it keeps return #ERROR when I tried to execute this expression:IIF(IsNothing(Fields!dbField.Value),"emtpy",Fields!dbField.Value)However, I tried the same expression with Reporting Services report (RDL), it works and return "empty" string.

View 3 Replies

State Management :: Creating A Static Variable And Adding To Session?

Oct 29, 2010

I am creating a static variable and adding to session.This variable has value that is user specific. Now I am getting a problem with this users are complaining that they are getting values that should be another users. It's like a mix up with session. Could this be because of static variable declaration?

View 2 Replies

Making The Down Arrow Key Behave As A Tab Key When In A GridView?

Mar 20, 2010

VWD 2008 Express. Visual Basic.

I want to sequence focus from a textbox in one row to the textbox in the next row in a gridview when the user presses the down arrow key, just as it does when the user presses the Tab key. How can this be accomplished?

View 1 Replies

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