mj168 mj168 - 1 month ago 9
Vb.net Question

Username created on PC app not recognized on Mobile app and vice versa

I have an ASP.Net web application for PCs and a mobile version of that web application for Phones. The application has a membership option so that users can create and login with a username and password.

The problem I am having is that when a user creates an account on the PC web application, his username and password are not recognized on the Mobile web application. The same thing happens in reverse. Accounts created on the Mobile web application are not recognized on the PC application.

The PC web application is in the PC_Laptop subfolder on our web hosting server's initial folder. The Mobile web application is in the Mobile_Tablet subfolder inside of the PC_Laptop subfolder.

Both the PC and Mobile subfolders have their own web.config files.

The database is on our web host's sql server.

Can anyone tell me how to fix this problem? User's of this web application should only have to create an account once and then be able to login on any device with the username and password they used to create the account.

Answer

If you are using Membership API this is the expected behaviour. All applications have a name property which is by default taken from the root path of the application. In your case the paths are not the same so Membership will create a new application record in the database and create users separately.

You have to set the application name in the web.config of both applications properly:

<membership>
  <providers>
    <clear/>
    <add name=...
      applicationName="SomeName"
      />
  </providers>
</membership>

See Scott Guthrie's blog about this.

Comments