Login with DragnetWebService API

A collection of information about Dragnet, including solutions to common problems.

Moderator: SourceGear

Locked
mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Login with DragnetWebService API

Post by mskrobul » Mon Jan 10, 2005 10:58 am

The LoginPlainText() api is the simplest way to login using the Dragnet Web Service api. Note that since the password is sent in plain text, the connection between the your application and the Dragnet web service should be secure.


A basic example for login follows:

Code: Select all

	
//Assuming Dragnet is the name of the web reference
	
Dragnet.DragnetWebService _dragnetService = null;

public bool Login()
{
			int ret = -1;

			_dragnetService = null;

			CookieContainer cc = new CookieContainer();

			_dragnetService = new Dragnet.DragnetWebService();
			
			_dragnetService.CookieContainer = cc;
			_dragnetService.Url = "http://localhost/dragnet/dragnetwebservice.asmx";

			string strAuthTicket = null;

			ret = _dragnetService.LoginPlainText("username", "password", out strAuthTicket);

			if (ret == 0)
			{
				
				_dragnetService.DragnetAuthValue = new Dragnet.DragnetAuth();
				_dragnetService.DragnetAuthValue.Token = strAuthTicket;
				return true;
			}
			else
				return false;

}
If the login is successful, you can perform operations that require a login using the web service, for example:

_dragnetWebService.ModifyItem()
Mary Jo Skrobul
SourceGear

Locked