473,394 Members | 1,812 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,394 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 3153
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

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.