Click here to Skip to main content
15,891,136 members
Articles / Security

WCF Service with custom username password authentication

Rate me:
Please Sign up or sign in to vote.
4.91/5 (63 votes)
25 Jul 2010CPOL5 min read 454.1K   16K   163  
This article describes custom username password authentication without the need of certificate installation on the client side.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CustomUsernamePasswordAuth.Service;

namespace CustomUsernamePasswordAuth.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            CustomUsernamePasswordAuth.Service.Service1 s = new Service1();
            
            
            string serverTime = s.GetServertime();

            try
            {
                
               // proxy.ClientCredentials.UserName.UserName = username;
               // proxy.ClientCredentials.UserName.Password = password;
            }
            catch(Exception)
            {
            }
            Label1.Text = " Server Time :";
        }
    }
}

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)


Written By
Software Developer Macmillan Publishing
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions