I have a strange problem in my website. I configured my website to run under
2 worker processes. (web garden enabled). and I stored my user information
in the current httpcontext(lik e
Httpcontext.cur rent.items.add( "__currentuser" , myUserobject") and retrieve
the user object like (user =
(UserType)Httpc ontext.current. items["__currentu ser"]). the website
authentication based on the form authentication. and I used login control
and customized the validation method.
No the bloody problem is. I opened two IE windows. and try to log into the
website using two separate account (1@1.com and 2@2.com). the login process
is successful, but after that, the two IE windows both display the
information for 1@1.com (instead of one for 1@1.com one for 2@2.com).
Is that anything related with web garden..?
I think the two IE windows should be two separated requests, so that
httpcontexts for two browsers should be different. am I rite?
cheers 16 2366
if you use cookies, and start a browser instance from the same root (new
tab, new window, link on desktop) they share the same session cookie,
and thus changing one changes all.
-- bruce (sqlwork.com)
Victor wrote:
I have a strange problem in my website. I configured my website to run under
2 worker processes. (web garden enabled). and I stored my user information
in the current httpcontext(lik e
Httpcontext.cur rent.items.add( "__currentuser" , myUserobject") and retrieve
the user object like (user =
(UserType)Httpc ontext.current. items["__currentu ser"]). the website
authentication based on the form authentication. and I used login control
and customized the validation method.
No the bloody problem is. I opened two IE windows. and try to log into the
website using two separate account (1@1.com and 2@2.com). the login process
is successful, but after that, the two IE windows both display the
information for 1@1.com (instead of one for 1@1.com one for 2@2.com).
Is that anything related with web garden..?
I think the two IE windows should be two separated requests, so that
httpcontexts for two browsers should be different. am I rite?
cheers
So for the httpcontext, all infomation will be stored in the cookie?
Is there another way to store the current context infomation?
cheers
"bruce barker" <no****@nospam. comwrote in message
news:uR******** ******@TK2MSFTN GP06.phx.gbl...
if you use cookies, and start a browser instance from the same root (new
tab, new window, link on desktop) they share the same session cookie, and
thus changing one changes all.
-- bruce (sqlwork.com)
Victor wrote:
>I have a strange problem in my website. I configured my website to run under 2 worker processes. (web garden enabled). and I stored my user information in the current httpcontext(lik e Httpcontext.cu rrent.items.add ("__currentuser ", myUserobject") and retrieve the user object like (user = (UserType)Http context.current .items["__currentu ser"]). the website authenticati on based on the form authentication. and I used login control and customized the validation method.
No the bloody problem is. I opened two IE windows. and try to log into the website using two separate account (1@1.com and 2@2.com). the login process is successful, but after that, the two IE windows both display the information for 1@1.com (instead of one for 1@1.com one for 2@2.com). Is that anything related with web garden..?
I think the two IE windows should be two separated requests, so that httpcontexts for two browsers should be different. am I rite?
cheers
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.Ite ms in
"BeginReque st" 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.Ite ms should not share the same data(data
in HttpContext.Ite ms should be distroyed after the current request be
processed and ended). Have you set any initial/default value for the
certain HttpContext.Ite ms entry? If convenient, would you post some of the
code snippet on how you store/intialize data into the certain
HttpContext.Ite ms 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/subscripti...ult.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/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
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.Cu rrent.Items["__CurrentU ser"] == null)
{
if (HttpContext.Cu rrent.User.Iden tity.Name == "")
return null;
MyUser user =
MyMemberShipPro vider.GetUser(H ttpContext.Curr ent.User.Identi ty.Name, false);
HttpContext.Cur rent.Items.Add( "__CurrentUser" , user);
return user;
}
return (MyUser)HttpCon text.Current.It ems["__CurrentU ser"];
}
set
{
if (HttpContext.Cu rrent.Items.Con tains("__Curren tUser"))
{
HttpContext.Cur rent.Items.Remo ve("__CurrentUs er");
}
HttpContext.Cur rent.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.GetNamed DataSlot 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]" <st*****@online .microsoft.comÐ ´ÈëÏûÏ¢
news:va******** ******@TK2MSFTN GHUB02.phx.gbl. ..
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.Ite ms in
"BeginReque st" 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.Ite ms should not share the same data(data
in HttpContext.Ite ms should be distroyed after the current request be
processed and ended). Have you set any initial/default value for the
certain HttpContext.Ite ms entry? If convenient, would you post some of
the
code snippet on how you store/intialize data into the certain
HttpContext.Ite ms 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/subscripti...ult.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/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no
rights.
Hi Victor,
Glad to hear from you. I don't think the "static" here is incorrect or
wrong here. The problem is possibly due to the HttpContext instances are
pooled(cached) so that a originally instanced HttpContext instance is
reused for multiple requests. You can try print out HttpContext instance's
HashCode to verify this.
However, as I mentioned in previous message, Context.Items collection is
not persisted between multiple page requests. If you want to store data
that will be used among multiple requests of a given client user, I suggest
you use SessionState, and for webfarm/webgarden scenario, you may need to
use SQL Server mode session. http://idunno.org/articles/277.aspx
Please feel free to post here if you need any further help.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Hi Steve.
I managed to print out the hash code of my current httpcontext instances.
everytime i refresh the page, the number is different. so can i assume that
no httpcontext get pooled?
I remove the static. now It looks working fine expect in the tabbed window.
it seems if i open two tabs in the same ie. and login as two different
users.
the last one's user infomation(http context) will override the pervious one.
does that mean the multi tabs in the same ie same the same httpcontext?
Thanks a lot for the help!
Cheers
Victor
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:nz******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Victor,
Glad to hear from you. I don't think the "static" here is incorrect or
wrong here. The problem is possibly due to the HttpContext instances are
pooled(cached) so that a originally instanced HttpContext instance is
reused for multiple requests. You can try print out HttpContext instance's
HashCode to verify this.
However, as I mentioned in previous message, Context.Items collection is
not persisted between multiple page requests. If you want to store data
that will be used among multiple requests of a given client user, I
suggest
you use SessionState, and for webfarm/webgarden scenario, you may need to
use SQL Server mode session.
http://idunno.org/articles/277.aspx
Please feel free to post here if you need any further help.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Thanks for your reply Victor,
For HttpContext instance, it does be separated for each client request,
actually, each ASP.NET request will be processed under a separate
HttpApplication instance. Here is a kb article describe this:
#INFO: Application Instances, Application Events, and Application State in
ASP.NET http://support.microsoft.com/kb/312607
For the following problem you mentioned:
=============== =============== ==========
it seems if i open two tabs in the same ie. and login as two different
users. the last one's user infomation(http context) will override the
pervious one.
does that mean the multi tabs in the same ie same the same httpcontext?
=============== =============== =========
Are you using SessionState to store some information that will be displayed
to user? For client browser(IE), if you use "tab" or "file-->new window" to
open a new browser, it will share the same session with original browser.
Only if you start a separate IE instance from program menu or shotcut will
it start a new session.
Also, as you mentioned that you'll need to display separate information for
each forms authenticated user, correct? If so, I think you can consider
using the "Profile" properties to store data that need to be separated for
each forms authenticated user. SessionState is not completely 1:1 mapping
to forms authentifcated user. Here are some reference about ASP.NET 2.0
profile properties:
#ASP.NET Profile Properties Overview http://msdn2.microsoft.com/en-us/lib...xs(VS.80).aspx
#Profiles In ASP.NET 2.0 http://www.odetocode.com/Articles/440.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Steve:
Thanks so much for the help.
for my problem.
=============== =============== ==========
it seems if i open two tabs in the same ie. and login as two different
users. the last one's user infomation(http context) will override the
pervious one.
does that mean the multi tabs in the same ie same the same httpcontext?
=============== =============== =========
I didn't use seesionstate to store my user infomation now. What I did is
when each request began, I create a user object from db then store them into
the httpcontext.cur rent.items collection. then it can be used across the
current request. This issue almost killed me......@_@
thanks a lot.
Victor
"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:ek******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Thanks for your reply Victor,
For HttpContext instance, it does be separated for each client request,
actually, each ASP.NET request will be processed under a separate
HttpApplication instance. Here is a kb article describe this:
#INFO: Application Instances, Application Events, and Application State in
ASP.NET http://support.microsoft.com/kb/312607
For the following problem you mentioned:
=============== =============== ==========
it seems if i open two tabs in the same ie. and login as two different
users. the last one's user infomation(http context) will override the
pervious one.
does that mean the multi tabs in the same ie same the same httpcontext?
=============== =============== =========
Are you using SessionState to store some information that will be
displayed
to user? For client browser(IE), if you use "tab" or "file-->new window"
to
open a new browser, it will share the same session with original browser.
Only if you start a separate IE instance from program menu or shotcut will
it start a new session.
Also, as you mentioned that you'll need to display separate information
for
each forms authenticated user, correct? If so, I think you can consider
using the "Profile" properties to store data that need to be separated for
each forms authenticated user. SessionState is not completely 1:1 mapping
to forms authentifcated user. Here are some reference about ASP.NET 2.0
profile properties:
#ASP.NET Profile Properties Overview http://msdn2.microsoft.com/en-us/lib...xs(VS.80).aspx
#Profiles In ASP.NET 2.0 http://www.odetocode.com/Articles/440.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
Hi Victor,
Thanks for your reply.
That does be a bit strange. I'd like to help perform some test on my side.
would you try creating a simplified web project(with the least page and
code ) that can repro the behavior? You can send it to me through email(my
email is in my signature , remove the "online" in it).
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve |
last post by:
Hi
What is difference between web farm and web garden?
What i understand so far
Web Farm
Multi Server Environment
Support Session share
Application object not supported
Caching not recommended (??)
What about Page Cache (??)
|
by: Dominic |
last post by:
I'd like to tune the performance of my application in a web garden.
Our server has dual processors. Is there any guideline to set this
"maximum number of worker processes" for web garden? In my
application, stress test shows that setting it to 2 gives a better
performance result. In other words, web garden helps. My first
question is if it...
|
by: domtam |
last post by:
Hi everybody,
As far as I understand, each worker process in a web garden (say, in
IIS 6.0) has its own copy of Cache objects, static objects and
Application(state) objects. In other words, they cannot be shared
across worker proesses.
Suppose my ASP.NET applications runs in a web garden with multiple
worker process (set in IIS 6.0...
|
by: Danny Ni |
last post by:
Hi,
I have questions:
(1) To establish web garden, a machine must have mutiple processors. Right?
(2) To use ASP.Net session in a web garden environment, process model must
be out-of-process, not in-process. Right?
(3) How do I change an ASP.Net web application to out-of-process state
management? The default is in-process, is it?
TIA
|
by: techie |
last post by:
I've got an ASP.NET application that runs Word macros after a user submits
it to the website. A web service written in C# does the work. Many users
can submit Word documents at any one time. However, the application only
processes 1 Word document at a time.
I had a problem during testing when several users submitted 10 documents
each at...
| |
by: Benny |
last post by:
I have a ASP.NET webservice and it is configured to run in a web garden with
multiple processes.
Whan a process in the garden is launched, I want the process to create a
background thread. When request are received by this instance of the garden
process, a meessage is posted to the background thread to do its work. When
the garden process...
|
by: Gery D. Dorazio |
last post by:
If a system consists of either a web farm or web garden does each of the
servers in the farm/garden have its own Global Assembly Cache? Please
suggest some helpful documentation on this topic if you can.
Thanks,
G. Dorazio
|
by: Cramer |
last post by:
I think I understand *what* a Web garden is (app running on a server with
multiple processors). But what's the benefit?
I have googled this and have found only articles that describe WHAT and HOW
to set up a Web garden, but not WHY - what's the advantage, and how would I
take advantage of the multiple processors? Is it as simple as me making...
|
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= |
last post by:
Is there any doc to config webfarm for asp.net 3.5 app?
I have found below article:
PRB: Session State Is Lost in Web Farm If You Use SqlServer or StateServer
Session Mode
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q325056
Does this article apply to asp.net 3.5 app?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |