I have an asp.net webform that looks like:
public partial class Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Thread.Sleep(10000); // wait 10 seconds
Response.Write("<h1>Hello world!</h1>");
}
}
If two users make a request about the same time one user will have to wait 10 seconds and the other 20 right? I just opened my browser and made two requests to http://localhost:10144/test.aspx
and one page opened in 10 seconds and the other in about 20. How can I have both users have to wait at most 10 seconds? Is it because the requests are coming from the same client?
Edit
Is because I am implementing polling in order for the server to send notifications to the client. Whenever I am polling the webserver if I am making another request to the website that request will take forever. Polling is so simple to implement I will later use something else such as websockets.
Solution
Thanks a lot for the help. Based on your comments what I will do is use a different cookie/session per request when polling. When polling I will use session A and wen making regular requests I will use session B. In other words I will have to cookieContainers when using: Using CookieContainer with WebClient class