.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WCF UserName authentication not firing?

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :ASP.Net

I have a WCF application set up to use UserName authentication through the built in MembershipProvider.  When I call up a simple test function to see if the user is authenticated I get false. Any idea what I am doing wrong? I've included as much info as I can.

The simple method in WCF:

      public bool CheckAuthentication()
            return System.Threading.Thread.CurrentPrincipal.Identity.IsAuthenticated;

Identity.Username and all that is blank as well.

This is the test code I'm using (from a test project):

          Oref.OfficeClient OC = new Oref.OfficeClient();

            OC.ClientCredentials.UserName.UserName = "username";
            OC.ClientCredentials.UserName.Password = "password";


            bool B = OC.CheckAuthentication();

And here are the relevant sections of web.config:

          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpsGetEnabled="true&quo

View Complete Post

More Related Resource Links

Getting windows username using windows authentication

Hi,I am developing one intranet website. Being an intranet application, one of the requirement is to have a single sign on feature. It means that the windows PC username (i.e the "ctrl + alt + delete" username) is going to be the username for the system.How do i fetch that username?I tried the following two ways which are working in debug mode but not on live site.System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User;        Response.Write(user.Identity.Name);&Response.Write(Request.ServerVariables["AUTH_USER"].ToString());Both the above method works when i run the page from visual studio.However when i run the page from IIS or any other server, it gives me a blank valuePlease help me as i cannot begin this project without solving this issue

SP 2010 Form Based Authentication username begins with "i:0#.w|"

Hello there! For the life of me, i can't figure out why SharePoint keeps putting the phrase "i:0#.w|" infront of everyones username / accounts. Both on mysite and portal sites. A quick bing search revelaed that i am not the only one: http://fangdahai.blogspot.com/2010/06/i0w-is-still-there-in-sharepoint-2010.html. Anyone have a solution to fix this annoying problem? Thanks!

Authentication (login - username/password)



I have a website developed in ASP.NET created by someone else, sitting on another server... until now... a simple(ish) setup with login to update content.

The site was zipped up and I was told it would be a simple case of uploading all the files onto the new server.  I've managed to upload the site and it works fine... but I can't access the editing pages as it will no longer accept the username and password when I go to login.

The host server is running ASP.NET v4 and IIS v7.  Hosting is with godaddy.com so I'm also getting used to their way of doing things.

Hope someone can help.


Obtain domain username without requiring authentication


I'm bangin' my head against the wall here.  I'm not even sure what I want to do is possible.

I have developed an ASP.NET app that will only be run on my local network (which incorporates a Windows Domain).  It's running on IIS 7.5.

I want to do this:

Dim username as string = Httpcontext.Current.User.Identity.Name

My problem is this: If I don't turn off Anonymous Authentication and ASP.NET Impersonation, I don't get the results I'm looking for.  (if Anonymous is allowed, I get an empty string returned for username, and if ASP.NET impersonation is allowed, then "username" is always whatever account is associated with impersonation, like "Network Service").  If I turn those off and then turn Windows Authentication on, it works, but only after a dialog box presents itself asking for the Windows Credentials.

What I'm trying to do is NOT require the users to log in.  Since they've already logged into the domain when they signed on their computer, I'd like to just allow them access to the ASP.NET application I've written, and identify who they are (based on their previous Windows login) using the line of code above.  I don't need them to re-authenticate, because they're already a

Keyset does not exist WCF +SSL + Username & Password authentication


My hosting is DiscountASP.NET

 I get Error "Keyset does not exist".

Please, see error on page: http://www.healthbucket.com/HealthbucketWCF/wcfUser.svc

Section in my web.config of wcf looks:
<serviceCertificate findValue="www.healthbucket.com" storeLocation="LocalMachine"
storeName="My" x509FindType="FindBySubjectName" />
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="UsernameValidator, App_code" />

I think there are two errors:
1. CryptographicException: Keyset does not exist
2. The certificate 'CN=www.healthbucket.com, OU=Domain Control Validated - RapidSSL(R), OU=See www.rapidssl.com/resources/cps (c)08, OU=GT10747045, O=www.healthbucket.com, C=IL' must have a private key that is capable of key exchange. The process must have access rights for the private key.]

 * I have SSL installed on my hosting and configuration is correct.

I ask technical support of DiscountASP.NET and they tell me &qu

WCF userName authentication with Silverlight 4 - Help



I got into the scenario that I have no clue what to start. 

I have a SL project with a WCF service inside.  Everything seems to be working correctly.  Now we want to create a UserName/password set in both SL client and Service so only this SL web can be accessed to its service. The purpose for this requirement is not to let over client to access to our service hosted in IIS and consume it.

I follow this post http://msdn.microsoft.com/en-us/library/ms733131.aspx to setup the username/password in the service.  However, the client used is not from SL.  Hence I don't know how to configure in SL front-end to provide the username/pass for the service.

Here is what I have:

in the service, I created a method as:

  public class CustomUserNameValidator : UserNamePasswordValidator
    public override void Validate(string userName, string password)
      if (null == userName || 

Logged in Username in Sharepoint 2010 Forms Based Authentication



When using forms based authentication in Sharepoint 2010, suppose user is logged in with username "admin" and our custom membership provider name is "FBAProvider"... After logging in with this account, logged in user name is displayed like "i:0#.|FBAProvider|admin". How can make it display as it should be like just "admin"?

Thanks in advance,


How do I get the userName and passWord sent by a client using http basic authentication in a wcf se


Hello Guys,

I need to get the username and password that my java clients are passing using basic http authentication.

The message my clients are sending is the following:

POST http://localhost:1715/PanelService.svc/PanelService HTTP/1.1<br/>
Accept-Encoding: gzip,deflate<br/>
Content-Type: text/xml;charset=UTF-8<br/>
SOAPAction: "http://br/com/petrobras/operational/services/PanelService/getAverageByBusinessObject"<br/>
Authorization: Basic YWJjZGVmOjEyMzQ1Ng==<br/>
User-Agent: Jakarta Commons-HttpClient/3.1<br/>
Host: localhost:1715<br/>

Explained: Forms Authentication in ASP.NET

This module explains how forms authentication works in ASP.NET version 2.0. It explains how IIS and ASP.NET authentication work together, and it explains the role and operation of the FormsAuthenticationModule class.

Using Forms Authentication in ASP.NET - Part 1

Classic ASP developers often had to "roll their own" authentication scheme, however, in ASP.NET much of the grunt work has been taken out. This article outlines how things have changed and how FormsAuthentication can be used to secure a Web site with a minimal amount of code.

ASP.NET Forms Authentication - Part 1

Often, in legacy Web applications, users authenticate themselves via a Web form. This Web form submits the user's credentials to business logic that determines their authorization level. Upon successful authentication, the application then submits a ticket in the form of a cookie, albeit a hard cookie or session variable. This ticket contains anything from just a valid session identification access token to customized personalization values.

ASP.NET forms authentication with roles

.A timeout is specified in minutes. This is "time since last request" not the "time since login". If a login is indicated to be persistent (described later) this is ignored.
.A protection method is specified for the cookie.
Next I wanted to specify a folder to which access is restricted to people who have logged in. To do this I entered the following code in the web.config file (beneath

Forms Authentication in ASP.NET

In this tutorial you will learn about Forms Authentication in ASP.NET 2.0 - Forms Authentication class, Cookie Domain, Forms Cookies, The Login Control, Signin, Signout, Authenticate, Redirect, Login Status, Login Name and Login View Controls.

Finding username


Im running a query where it selects a property from the user with the matching username but i dont know how to find out the username of the currently loggedin user.

Please Help!

Web Matrix + Windows Authentication


I'm curious if its possible to get windows auth working with asp.net webpages/webmatrix.

I've got it published to IIS with windows auth turned on and anonymous/forms/basic turned off.

I'm guessing the WebSecurity Helper probably won't work here but can you access User.Identity.Name etc?

Sorry for the newbie questions, I've only just started working with asp.net ^^,

Problems with Forms Authentication in DD 4 site


Hello,  I am seeing a strange problem with Forms Authentication in my DD site.   A user logs into and can view/edit/delete data all day, but when they execute a Custom Filter against data (for example , a control DynamicData/Filters/CustomerLastNameSearch.ascx ) then the site auth fails, and redirects to the log in screen.

in web.config I have

     <authentication mode="Forms">
            <forms name=".Star" loginUrl="~/Login.aspx" protection="All" defaultUrl="~/Default.aspx" path="/" timeout="43200" cookieless="UseCookies" />     

Offhand, I am thinking two things : that DynamicData/Filters path requires some special handling for some reason, or the control extension ascx is causing auth to get confused.   Has anyone else experienced this or have any suggestions?  Thanks!

Sharing authentication ticket between two applications


Hi all,

I have two web applications:

1. http://www.mysite.com - primary app running at the root of the web server

2. http://www.mysite.com/second_app - running in a virtual directory

At user authentication, I'm using FormsAuthenticationTicket to set up authentication cookies. Is it possible to share the same cookie for both the apps?

Any help would be much appreciated.

Many thanks!

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend