开发者

Advantages and disadvantages of using application variables in web applications

开发者 https://www.devze.com 2023-01-03 05:05 出处:网络
I haven\'t used the app开发者_Go百科lication variables in my asp.net web applications. I\'m using asp.net2.0. Is there any disadvantages of using applicationvariables. What do you mean by application

I haven't used the app开发者_Go百科lication variables in my asp.net web applications. I'm using asp.net2.0. Is there any disadvantages of using applicationvariables.


What do you mean by application variables? Like:

private int _key = 0;

If so, these kinds of variables are not saved between web requests. When the page unloads, and you have to use session or cache or viewstate to store it like:

ViewState["Key"] = 1;

or

Session["Key"] = 1;

And reload it from here when the page loads again. If you mean something else, please comment and I'll update my response.

EDIT: For application, check these out:

  • http://weblogs.asp.net/plip/archive/2003/12/01/40526.aspx
  • http://www.dotnetheaven.com/UploadFile/mahesh/ApplicationState05102005051501AM/ApplicationState.aspx

Application state is application-wide storage, and so to limit to a user, you need to append the user ID to the key, or use session.

0

精彩评论

暂无评论...
验证码 换一张
取 消