Re: Strange web garden problem.... :(

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Steve:
Thanks for the reply.. my problem is really strange.

my code look like I have this property in my base page.. but i make it as
static.. do you think it's the static make the problem?(make someone
overwrite another person's value)

public static MyUser CurrentUser
{
get
{
if (HttpContext.Current.Items["__CurrentUser"] == null)
{
if (HttpContext.Current.User.Identity.Name == "")
return null;

MyUser user =
MyMemberShipProvider.GetUser(HttpContext.Current.User.Identity.Name, false);
HttpContext.Current.Items.Add("__CurrentUser", user);

return user;
}

return (MyUser)HttpContext.Current.Items["__CurrentUser"];
}

set
{
if (HttpContext.Current.Items.Contains("__CurrentUser"))
{
HttpContext.Current.Items.Remove("__CurrentUser");
}
HttpContext.Current.Items.Add("__CurrentUser", value);
}
}


Another question will be if I store this user object inside the httpcontext,
just as you described, each time a new request initialize, it need to
recreate the user object again(that means access database, recreate the
object) that will increase the server load.I actually do not want to do
that. our website has a quite heavy loading now. So is there anyway I can
store a user object for each user during the period they visit the website
without recreating the user object for every request? Previous I use
thread.GetNamedDataSlot to store the user information. but sometimes it will
lost the information. And I will use Ajax in my website. some people said
that the using thread to store the user info is quite good in the ansync
situation. Can you please give me some information about this.

Cheers
Thank you.










"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> дÈëÏûÏ¢
news:vaNOd70dHHA.4368@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Victor,

As for the HttpContext instance, each coming ASP.NET request will has such
an instance associated with it, and you can refer to many other resource
associate with this request(such as session, request, response .....). And
for the "Items" property, it is a simple Dictionary collection that can
help us transfer some data across each ASP.NET request's server-side
pipeline. For example, you can store some data into Httpcontext.Items in
"BeginRequest" event and retrieve it later in Page's Load event.

As far as I know, no matter whether you're using webgarden or not,
different request's HttpContext.Items should not share the same data(data
in HttpContext.Items should be distroyed after the current request be
processed and ended). Have you set any initial/default value for the
certain HttpContext.Items entry? If convenient, would you post some of
the
code snippet on how you store/intialize data into the certain
HttpContext.Items entry and how do you retrieve it and use it(display on
page or ...)? I think there could be something else that cause the
Context
items messed.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no
rights.












.



Relevant Pages

  • Whats in in the block git tree for 2.6.28?
    ... Support for handling online resizing of block devices. ... Adds block layer support for the 'discard' operation, ... By dropping it we can also shrink request ...
    (Linux-Kernel)
  • The understanding toward Mitch
    ... spanish mergers are surviving, ... Are you semantic, I mean, paying in support of ... produces Woodrow, it depends Kathy instead. ... store and conform it in particular its store. ...
    (sci.crypt)
  • 2.6.0-test9 OOPS! kswapd0 exited with preempt_count 1
    ... This oops appears first and one time, when gzipping a directory in /tmp (ext3). ... Oct 30 05:06:31 djgera kernel: Unable to handle kernel paging request at virtual address 540092c4 ... Linux Plug and Play Support v0.97 Adam Belay ...
    (Linux-Kernel)
  • Almost no confident cables allege Dianna, and they suspiciously travel Ayn too.
    ... confuses in support of it, ... My preliminary allowance won't store before I weigh it. ... honour the organic teaching. ... Who did Hakim resign for example all the wests? ...
    (sci.crypt)
  • [RFC 0/6] bidi support: block, SCSI, and iSCSI layers
    ... Following are 6 patches that introduce support ... OSD tests are the ones who exercise BIDI I/O. ... extract io related fields in struct request into struct request_io_part ... use new API for accessing the new sub-structure ...
    (Linux-Kernel)