PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → How to tell Windev 23 REST webservice to use a custom web.config instead of the machine.config ?
How to tell Windev 23 REST webservice to use a custom web.config instead of the machine.config ?
Started by Peter DEWACHTERE, Dec., 10 2018 4:54 PM - No answer
Registered member
1 message
Posted on December, 10 2018 - 4:54 PM
I have this REST webservice (wd23) deployed on a IIS7.5 webserver.
I added the System.Web.Security assembly of the .Net framework to be able to call the ChangePassword method on the MembershipUser class.

So I create this object:
user is "System.Web.Security.MembershipUser" dynamic

and I call this method:
bRes is boolean = user.ChangePassword(sOldPassword,sNewPassword)

This works fine in production as long as I define the membership/rolemanager providers and its connectionstring in the machine.config of the server.

This is the part of the machine.config I added:

<connectionStrings>
<add name="MySecurityDB" connectionString="..." providerName="System.Data.SqlClient"
</connectionStrings>
<membership defaultProvider="MyMembershipProvider">
<providers>
<add
name="MyMembershipProvider"
connectionStringName="MySecurityDB"
applicationName="Website"
...
type="System.Web.Security.SqlMembershipProvider" />
<add
name="AspNetSqlMembershipProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
...
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
<roleManager defaultProvider="MyRoleProvider">
<providers>
<add
name="MyRoleProvider"
connectionStringName="MySecurityDB"
applicationName="Website"
type="System.Web.Security.SqlRoleProvider" />
<add
name="AspNetSqlRoleProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>

The normal way of overriding the machine.config is to put a local web.config in the rootfolder.
So if I don't add it to the machine.config but to a web.config in the root of the webservice, these settings are not picked up by the windev webservice. It seems the webservice can't find the custom web.config. I can view in my log that the webservice uses the 'default membership settings' and default 'LocalSqlServer' connectionstring of the machine.config instead.

Any ideas on how to solve this ?

gr, Peter