473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Webservice and Cookies

Hi,

I'm trying to access a few webservices (asmx) which are stored on the
same remote computer (e.g.: test.name.com). Now the first asmx which I
add gets a namespace: com.name.test and the second one get a
namespace: com.name.test2 whatever I do this is always like this.

Now the first asmx file handles authentication... e.g.:

com.name.test.LogonService LoginServer = new com.name.test.LogonService();
....

if(LogonServer.Logon(username, password)==true)
{
//etc
}
this works fine...

The authentication stores a cookie to make sure you are authenticated.

however the other service knows nothing about this cookie.
so the other service could be like this:

com.name.test2.InteractionService IntServer = new
com.name.test2.InteractionService();
....

if(IntServer.SomeFunction(...)==true)
{
//etc
}

Returns errors that I am not authenticated.

how can the cookie obtained with the first service be used with the
second service??
Thanks!

Reinier

p.s. I made this whole thing using regular HTTP commands and it works
good. (that is, when remebering all the cookies). Of course, I'd prefer
using this method since it is much more simple if it would work.
Nov 23 '05 #1
2 3150
ok found the solution myself:

before calling the Logon I have to install a cookiecontainer:
LogonServer.CookieContainer = new CookieContainer();
and then I copy this cookie container to every subsequent call:
IntServer.CookieContainer = LogonServer.CookieContainer;
R


Reinier v Vliet wrote:
Hi,

I'm trying to access a few webservices (asmx) which are stored on the
same remote computer (e.g.: test.name.com). Now the first asmx which I
add gets a namespace: com.name.test and the second one get a
namespace: com.name.test2 whatever I do this is always like this.

Now the first asmx file handles authentication... e.g.:

com.name.test.LogonService LoginServer = new com.name.test.LogonService();
...

if(LogonServer.Logon(username, password)==true)
{
//etc
}
this works fine...

The authentication stores a cookie to make sure you are authenticated.

however the other service knows nothing about this cookie.
so the other service could be like this:

com.name.test2.InteractionService IntServer = new
com.name.test2.InteractionService();
...

if(IntServer.SomeFunction(...)==true)
{
//etc
}

Returns errors that I am not authenticated.

how can the cookie obtained with the first service be used with the
second service??
Thanks!

Reinier

p.s. I made this whole thing using regular HTTP commands and it works
good. (that is, when remebering all the cookies). Of course, I'd prefer
using this method since it is much more simple if it would work.

Nov 23 '05 #2
ok found the solution myself:

before calling the Logon I have to install a cookiecontainer:
LogonServer.CookieContainer = new CookieContainer();
and then I copy this cookie container to every subsequent call:
IntServer.CookieContainer = LogonServer.CookieContainer;
R


Reinier v Vliet wrote:
Hi,

I'm trying to access a few webservices (asmx) which are stored on the
same remote computer (e.g.: test.name.com). Now the first asmx which I
add gets a namespace: com.name.test and the second one get a
namespace: com.name.test2 whatever I do this is always like this.

Now the first asmx file handles authentication... e.g.:

com.name.test.LogonService LoginServer = new com.name.test.LogonService();
...

if(LogonServer.Logon(username, password)==true)
{
//etc
}
this works fine...

The authentication stores a cookie to make sure you are authenticated.

however the other service knows nothing about this cookie.
so the other service could be like this:

com.name.test2.InteractionService IntServer = new
com.name.test2.InteractionService();
...

if(IntServer.SomeFunction(...)==true)
{
//etc
}

Returns errors that I am not authenticated.

how can the cookie obtained with the first service be used with the
second service??
Thanks!

Reinier

p.s. I made this whole thing using regular HTTP commands and it works
good. (that is, when remebering all the cookies). Of course, I'd prefer
using this method since it is much more simple if it would work.

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Abeslom via .NET 247 | last post by:
Hi, I am trying to create a simple .NET http-Get client that willconsume a java webservice on a mainframe. If I type the URL forthe webservice in the Browser, the service works and I get theexpected...
0
by: baiju | last post by:
hi, i wrote webservice using C#.trying to call same from vc.net.i added webservice using wizard.i created object of webservice.i called first method, it worked fine.but i try to call another...
5
by: jb | last post by:
*Please* help --- I'm tearing my hair out. I want to use sessionstate in a webservice, accessed from a client, written in script (JScript, InfoPath). I have written my webservice (C# .NET). I...
1
by: Monster | last post by:
is it possible to manually create and destroy a session object in a webservice? My original client and server were done with SOAP in c++ (isapi dll and mfc/atl). I managed to write an intermediate...
7
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA: System.Web.Services.WebService { private int X = 0;
2
by: GMG | last post by:
Is it possible to use FormAuthentication or do I have to manage my own cookies and if so a sample/URL would be greatly appreciated.
6
by: Eric | last post by:
I would like to read cookies in the client (WinForm App), which where sent by a server. I have set "ws.CookieContainer = New System.Net.CookieContainer()" in my client, before I call the...
4
by: =?Utf-8?B?TmFkYXYgUG9wcGxld2VsbA==?= | last post by:
Hi everybody, I've got two questions about using the EnableSession property with an ASP.NET WebService: First Question: I'm trying to create a web service with EnableSession=true. I can't...
0
by: Daniel Knöpfel | last post by:
Hi We have developed a webservice that was accessed by a fat windows client. A security requirement was that the client authenticates itself by using by providing a client certificate. The...
2
by: Mike Endys | last post by:
Hi all, have problem to use login to the web service. Im thinking about the web service that provides datas and files to the WinForm Client. I want the client log-in to the application... here...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.