Emulate multiple Http sessions from a Console Application

G

Giulio Petrucci

Hi there,

I'm testing an ASP.NET application which is intendet to create a log
file for each Http session. How can I emulate two (or more) sessions
sending request to my ASP.NET page from a console application? I tried
with two WebClient instances sending requests but on the Server side I
have one session for each request.
Any suggestion?

thanks in advance,
Giulio
--
 
F

Family Tree Mike

Giulio said:
Hi there,

I'm testing an ASP.NET application which is intendet to create a log
file for each Http session. How can I emulate two (or more) sessions
sending request to my ASP.NET page from a console application? I tried
with two WebClient instances sending requests but on the Server side I
have one session for each request.
Any suggestion?

thanks in advance,
Giulio
--

Internet Explorer treats separate tabs as a single session. Presuming
this is similar to the WebClient, then I suspect you may need multiple
processes. You might try separate credentials for the two web clients.
That should be treated as separate sessions, but I have not tried it.
 
A

Arne Vajhøj

Giulio said:
I'm testing an ASP.NET application which is intendet to create a log
file for each Http session. How can I emulate two (or more) sessions
sending request to my ASP.NET page from a console application? I tried
with two WebClient instances sending requests but on the Server side I
have one session for each request.
Any suggestion?

Something like:

CookieContainer session = new CookieContainer();
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.CookieContainer = session;
....
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.CookieContainer = session;

same cookie container => same session
different cookie container or no cookie container => different session

Arne
 
G

Giulio Petrucci

Hi Arne,
CookieContainer session = new CookieContainer();
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.CookieContainer = session;
...
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.CookieContainer = session;

same cookie container => same session
different cookie container or no cookie container => different session

unfortunately it doesn't work.
Maybe it's because the session is empty and no cookie is created on the
servr-side?

Ciao,
Giulio
--
 
A

Arne Vajhøj

Giulio said:
unfortunately it doesn't work.
Maybe it's because the session is empty and no cookie is created on the
servr-side?

There are only two ways by which the server can identity requests
belonging to the same session: cookies and URL rewriting.

Are the server using URL rewriting?

Arne
 
G

Giulio Petrucci

Hi Arne,
There are only two ways by which the server can identity requests
belonging to the same session: cookies and URL rewriting.

Are the server using URL rewriting?

I'm using the Visual Studio Web Developer debugging server, so I assume
no. :)

Thanks,
Giulio
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top