User verification on ASP.NET and MySQL fails on live - asp.net

I'm not a developer, but need to fix an app that is based on .NET (2.0) and MySQL. I have searched quite a bit, hence the question.
Checked everything on staging, and it seems to be working fine. However, when move to live, users cannot log in. Exact same setup, just change the connection string and connects to the staging database and user log in. I also know that in both circumstances a connection to the database is being made. Users can register and are added to the database.
I believe the same happens when the .NET applications connect to a SQL Server database, however, it is possible to change "applicationname" in the web.config.
So the questions are:
Is there also an "applicationname" change for MySQL?
Could there be anything else causing the problems?

Related

Are ASP.Net membership credentials portable?

Why are ASP.Net membership credentials stored in a database not portable between (1) web apps and (2) machines?
Two scenarios --
We backup the production database and restore it to the development server. None of the production login credentials work on the development server, even though the underlying data was restored from production seconds before.
We build a new version of the app ("v2," let's call it), and install it on the production database under a different website (alongside the production app -- "v1"), but talking to the same production database. None of the login credentials work on v2 of the app, even though it's talking to the same database and therefore has the exact same membership data.
There is no machine key in the web.config file. If I leave this out, I assume it bubbles up from the machine.config file, which means it should be the same per machine, which means the two webapps talking to the same database on the same machine (the second scenario above) should share credentials, correct?
We also checked the application names and IDs in the databases, and they are identical between machines.
If you reset the passwords, everything works fine (with new passwords). But that means everyone has to reset their passwords, which isn't ideal.
It seems that somehow, the password salt changes from database server to database server and from web app to web app.
Edit:
Using ASP.Net 4.5 and System.Web.Security.SqlMembershipProvider 4.0.
Another Edit:
I have verified the PasswordFormat is "Hashed." Additionally, I have checked the Password and PasswordSalt fields between the two databases. They are identical.
Solution:
The hashing algorithm in the web.config was set differently between the two apps.
The hashing algorithm was different between the two webapps. One was using the default "SHA1," and the other was explicit set to "HMACSHA512."

How to effectively set up MySQL Users and Roles in the production server WITHOUT Visual Studio?

So far I have been using the WebSite Administration Tool built in Visual Studio 2010 to manage Users and Roles along with MySQL Membership and Roles Provider.
Now, I have deployed the application to the production server and I am getting the following error:
Even if I tried to copy one of the roles and one of the users from my local DB to the one used by the production server, it didn't quite work and I keep getting the same error. At least, I'm sure that's the cause of the error because I did a remote debugging which led me to find it.
At this point I am very confused on how to get it working properly. So, any help or guidance would be really appreciated.
EDIT: At this point the User has been already authenticated in the login page using the connectionString to the production DB server. For that reason, I have dismissed any kind of problems related to the connectionString. I get this error while loading the masterPage where the role is needed in order to choose which menu to display.
The exception message says it all: It cannot connect to the database. Verify that your production DB server is running, that the connection string is correct and that you have network connectivity (including name resolution) from the web server to the DB server.
The solution for this problem was to create the mysql_aspnet_membership provider by granting full access through the machine.config and autogenerating the schema, instead of manually creating the membership tables in the database, which I though there could have been a valid way to create the db.
Afterwards, this didn't break anymore.

SQL Server Timeout Accessing ASP.NET Profile Provider

Hmm, strange one: My ASP.NET 2.0 website all of a sudden starts throwing SQL Server timeout errors. Only solution is to reboot SQL Server. IISRESET on web server doesn't fix it.
Error seems to occur when reading (or writing) from ASP.NET user profile.
If I connect to database directly via SQL Server Management Studio, I can read and write to the aspnet_profile table just fine.
When Googling I discovered one suggestion: to make sure there aren't other providers in machine.config and that I've got a CLEAR element in my web.config to clear those out. Sure enough there were. So my first step was to add in CLEARs in my web.config. Did that and still the error. Then I went into machine.config in the .NET 2.0 area and cleared out the SQLexpress entry and the providers (3 of them). Still no dice.
I want to try and solve the root problem without rebooting the database server.
Note that pages that access the database but not the profile work just fine. BTW, there are 2 connection strings - one for the providers (membership, role, profile, and webparts) and the other for the app data access.
Any suggestions????
Thanks,
Krip
I believe I've solved the problem. The get and set profile properties stored procedures update the LastActivityDate on the aspnet_users table. This was hanging. Not a good idea to have so many unnecessary udpates on users table. I commented that out and all is fine for the moment.

IIS7 application using wrong SQL Server 2008 Express database

I'm stumped. I have a client site on a virtual private server - Windows Web Server 2008 SP2, IIS7, SQL Server 2008 Express.
I'm trying to setup a second web application, to allow him to review updates prior to their going live. I've created the web application in IIS7, and I have added a second database to SQL Server. The second db is essentially a copy of the production db, with 'DEV' prefixed to the database name and a few new fields in a few tables.
My production site works fine. However, the test site comes back with an SqlException: "Invalid column name 'version'." This is one of the new fields - which leads me to believe that my dev site is referring to the production database, and not the dev database. Connection strings, however, do point to different databases (although the login is the same for both):
Production site: "Server=.\SQLExpress;Database=myDbName;User ID=myUserName;Password=myUserPassword;"
Dev site: "Server=.\SQLExpress;Database=DEVmyDbName;User ID=myUserName;Password=myUserPassword;"
Seems like this should be something obvious that I'm missing. A colleague suggested that I create another application pool for the second IIS application, but it does not seem to have helped.
UPDATE, following further testing:
I changed the dev site's connection string to
"Server=.\SQLExpress;Database=DEVmyDbName;User ID=devuser;Password=myNewDifferentPassword;"
and created a new SQL server login on the database, and only gave it access to the dev database. I also set the dev database as the account's default database. I removed access to the dev database from the production login. When I try to login to the site, I get the following error:
The server principal "devuser" is not able to access the database "myDbName" under the current security context.
As a result, there are two things I know for certain:
Since it's using the new username to login, I know the app is using the connection string I'm feeding it;
For some reason, once logged in, it appears to be ignoring the specified database and trying to use the production database instead.
I don't think it should make a difference, but I will mention I'm using NHibernate for database access.
Still stumped.
It turns out that NHibernate was significant. One of the NHibernate configuration options that was set was "default_schema" - when I removed it, the app started connecting to the correct database.
It appears that the default_schema property was overriding whatever database was specified in the connection string.

problems with user instance SQL Server 2005 Express mdf file

I have a web app that I am working with on a separate server. I didn't originally create it, but I have to maintain it. I had to to do some manual editing of one of the database tables, which I did through Visual Studio 2008 installed on the same machine. Now I get SQL exceptions regarding Network Service not having the right privileges.
How do I avoid this from happening? I haven't modified any settings regarding the security or access information. It was working before I made the modification, and now it isn't.
Thanks!
Did you by chance change the connection information stored for the DB? Perhaps remove a explicit user (SQL Authentication) and replace it with a Trusted_Connection?
Also did you change the webserver to no longer use authentication?
The error sounds like it is coming from the fact that the Network Service account (the one generally responsible for running ASP.NET pages) cannot access the DB. This happens mostly when authentication is disabled, and there is no explicit SQL Authentication.

Resources