Sunday, February 19, 2012

Cant login remotely even though membership data is present

(Sorry this was posted to VWD2005 Express by mistake)

I have created a simple project using ASP.NET 2.0 which enables a user to login. I created the login user using the Web Administration Tool in Visual Studio 2005.

I created everything locally and it worked.

Locally I have 2 databases. One containing normal data (which my site uses to populate a GridView control) and the other being ASPNETDB.MDF - which contains membership (login user) data. These 2 databases sit in the App_Data folder which is in the root of the project.

I have a remote database which is hosted in a shared environment.

This is just the one database and it appears to have all tables in the one database (membership tables and normal tables - such as the one I use to populate my GridView control).

I uploaded the website and using the Database Publishing Wizard I uploaded the database data to the shared host. I also changed the connection string to point to my remote database.

If I visit the website the GridView is populating correctly (pulling data from the remote database) but when I try to login it crashes. The error is "Access denied creating App_Data sub directory".

The membership login details for the user I created are in the remote database as I have compared the data in it to the data in my ASPNETDB.MDF local database.

If I launch from within Visual Studio 2005 then it allows me to login perfectly well.

Please does anybody know why it won't let me login when I access it via the website?

Many thanks for any help,

Graham

It seems that appropriate machine user (that is usualy NETWORK SERVICE) under which this web application is running has no write rights over App_Data subdirectory.

Check with your host if that is setup properly.

|||

Well I am pleased to say my work colleague fixed this one.

I had to change the ConnectionString name to LocalSqlServer and change my DataSource control (see below).

I had them named something else before. Please can somebody explain what is going on here and why it wasn't working before?

<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="BLAH BLAH BLAH"
providerName="System.Data.SqlClient" />
</connectionStrings>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>"

Many thanks.

|||That's because LocalSqlServer is the connection string used by?default security providers. Take a look at this article for details:

http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

No comments:

Post a Comment