Search code examples
web-servicesoracle-database.net-4.0membership

Problems with Oracle Membership Provider and Framework 4


I'm having serious problems with creating a Web service in Visual Studio 2010 (Framework 4).

Anyway, I have to use a Oracle membership provider (I have installed "Oracle Providers for ASP.NET 4 11.2.0.2.0', which modifies the framework's machine.config), but I can not connect to the membership.

My code in web.config is as follows:

<configuration>
<connectionStrings>
    <remove name="OraAspNetConString"></remove>
    <add name="OraAspNetConString" connectionString="User Id=USUARIO;Password=PASSWORD;Data Source=DATABASENAME;" providerName="Oracle.DataAcces.Client"/>
</connectionStrings>

<system.web>

<membership defaultProvider="OracleMembershipProvider" userIsOnlineTimeWindow="30"/>
<roleManager defaultProvider="OracleRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All"/>
    <authentication mode="None"/>
    <authorization>
        <allow users="*"/>
    </authorization>

I also added the reference 'System.Web.ApplicationServices' to my project.

To test the connection to the membership of Oracle I have put this code in one of the OperationContract that has my web service:

 MembershipUserCollection userC = Membership.GetAllUsers();

 sample.StringValue += " - " + userC.Count;

 bool resp = Membership.ValidateUser(id, id2);

The obtained MembershipUserCollection always appears without users. UserC.Count always equals zero. The parameters 'id' and 'id2', username and password respectively, are used to validate (that is a poor use, I know) but always returns false.

Anybody can help me with this?

Thanks a lot.

PD: Authentication mode is 'None', I've tried with 'Forms' and still not working.


Solution

  • Problem solved.

    I needed to put the name of the application (applicationName) on the label of the membership and role manager providers (in the file machine.config).

    :-)