what prevents the confliction in HttpContext?

Last post 07-06-2009 2:14 PM by anas_aljabri. 2 replies.

Sort Posts:

  • what prevents the confliction in HttpContext?

    07-04-2009, 2:56 PM
    • Member
      1 point Member
    • anas_aljabri
    • Member since 02-25-2009, 5:13 AM
    • Posts 3

    Hi all i just joined this group. and i will start bothering you by question :D

    As i know HttpContext Object is an object which contains most of the common details about an HttpRequest and we can ask about the current HttpRequest using the following code

    HttpContext context = HttpContext.Current;

    does that mean always in the application only one Request will be serving at a time ??

    if the application can serve multiple Requests, what prevents the confliction in the following code

    HttpContext context = HttpContext.Current;
    context.Items.Add("UserID", "11");
    Server.Transfer("AnotherForm.aspx");

    and in AnotherForm.aspx

    string UserID = HttpContext.Current.Items["UserID"];

    what guarantee that this Application is not serving a new Request.

  • Re: what prevents the confliction in HttpContext?

    07-04-2009, 6:41 PM
    Answer
    • All-Star
      60,921 point All-Star
    • anas
    • Member since 09-21-2006, 8:31 AM
    • Palestinian Territory, Occupied
    • Posts 6,865
    • Moderator

    Anas_Aljabri:

    if the application can serve multiple Requests, what prevents the confliction in the following code

    HttpContext context = HttpContext.Current;
    context.Items.Add("UserID", "11");
    Server.Transfer("AnotherForm.aspx");

    and in AnotherForm.aspx

    string UserID = HttpContext.Current.Items["UserID"];

    what guarantee that this Application is not serving a new Request.

    It serve more than a request at the same time and there will be no conflict because each request will have it's own HttpContext object.

    For example, let's say that 2 users requested your website at the same time, then each user will be given a seprate HttpContext which encapsulates the data related to each user request.



    Regards,

    Anas Ghanem | Blog

  • Re: what prevents the confliction in HttpContext?

    07-06-2009, 2:14 PM
    • Member
      1 point Member
    • anas_aljabri
    • Member since 02-25-2009, 5:13 AM
    • Posts 3

     Thanks Alot for this help now it's clear in my brain.

Page 1 of 1 (3 items)