Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Web Service Authentication

, 25 Nov 2009
A simple mechanism to authenticate users to a WebService
webserviceauthentication_src.zip
src
Global.asax
WebServiceAuthentication.csproj.webinfo
bin
WebServiceAuthentication.dll
Web References
ServicePointReference
Reference.map
ServicePoint.disco
ServicePoint.wsdl
src_VS2005
Global.asax
App_Code
App_WebReferences
ServicePointReference
WebServiceAuthentication
ServicePointReference
ServicePoint.disco
ServicePoint.discomap
ServicePoint.wsdl
src_VS2010
App_Code
App_WebReferences
ServicePointReference
WebServiceAuthentication
ServicePointReference
ServicePoint.disco
ServicePoint.discomap
ServicePoint.wsdl
Global.asax
WebServiceAuthentication.suo
<%@ Page language="c#" Codebehind="TestAuth.aspx.cs" AutoEventWireup="false" Inherits="WebServiceAuthentication.TestAuth" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>TestAuth</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name=vs_defaultClientScript content="JavaScript">
		<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
	</HEAD>
	<body MS_POSITIONING="GridLayout">

		<form id="Form1" method="post" runat="server">
			<asp:Label Runat=server ID=ServResponse BackColor=#ffcc00>WebServiceResponse</asp:Label>
			<hr>
			<asp:Label id="LabelUser" runat="server" Width="72px" Height="24px">UserName: </asp:Label>
			<asp:TextBox id="TextBoxUserName" runat="server"></asp:TextBox>
			<br>
			<asp:Label id="LabelPwd" runat="server" Width="72px" Height="24px">Password: </asp:Label>
			<asp:TextBox id="TextBoxPwd" runat="server"></asp:TextBox>
			<br>
			<asp:Label id="LabelToken" runat="server" Width="72px" Height="24px">Token: </asp:Label>
			<asp:TextBox id="TextBoxToken" runat="server" Width="300px"></asp:TextBox>
			<br>
			<br>
			<asp:Button id="ButtonAuth" runat="server" Text="TestAuthentication"></asp:Button>
			<br>
			<hr>
			The password to get authentication is: SeCrEt+"ServiceName".<br>
			I.D. if the "ServiceName" is "Test1" the password must be "SeCrEtTest1"<br>
			Please note that in this sample the password is case sensisitive, while the username is not.
			<br>
			<br>
			<asp:Label id=LabelSrv runat="server" Width="72px" Height="24px">Service: </asp:Label>
			<asp:TextBox id=TextBoxService runat="server">ServiceName</asp:TextBox>
			<br>
			<br>
			<asp:Button id="ButtonService" runat="server" Text="TestService"></asp:Button> Test Service Authorization using local clock
			<br>
			<br>
			<asp:Button id="ButtonGetToken" runat="server" Text="GetToken"></asp:Button> Service
			GetToken (the token you get here is valid during the current minute and the following)
			<br>
			<asp:Button id="ButtonUseToken" runat="server" Text="TestService"></asp:Button> Test Service Authorization using Token
		</form>

	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

faina
Web Developer
Italy Italy
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 25 Nov 2009
Article Copyright 2005 by faina
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid