Hey.

Ok, i already asked this question on asp.net and sqlteam forum, but without any luck. Hope it will be diferent here :)

So, here the thing:

I have created some users to my site using the WAT tool.
Therefore, the users information was automatically stored in ASPNETBD.mdf file.

When running the site in Visual Studio 2008, it works all just fine, but after deploying, i'm still able to query the database, but the logins no longer work. I always get: “Login attempt unsuccessful, please try again.”

I found that the problem is exposed on http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx

but unlike on this example, i do not have any <Membership> tag on my web.config file, only <roleManager enabled="true"/>, which following the suggestion on the site above, i replaced with:

<roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
<providers>
<add
applicationName="/"
name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>

But no good. I'm still getting the same error after deploying. anyone knows how to fix that?

Hi there and welcome to DaniWeb. :) I have conducted an investigation into your problem (I haven't come across this before myself) and believe the remedy may be to place applicationName="/" just before the closing tag of providers instead of at the top above name and type. Also have you tried putting your application name in there as opposed to just "/" ? As in:

applicationName="/yourappname"

Hope this helps.

:)

My application name, as i checked on my 'aspnet_Applications' table, is in fact "/" :)

I will only be able to test that tomorow in my work environment. Will give you some feedback then.

Thanks for your time :)

You are welcome, hope this fixes your issue. Odd that your application is named "/". Why is that ?

In fact, I recommend you DO give your application name as per this article here:

http://dotnettipoftheday.org/tips/applicationName_attribute.aspx

The upshot of the above article is that if you DO NOT give your application a name, ASP.NET will use the application vroot path within the web-server to automatically calculate the applicationName to use when adding data to an ASP.NET Application Service database. When the application is copied/moved to another location ASP.NET will be looking at a different virtual path for users in a database, therefore not finding them! Which is probably the solution to your issue! Might I recommend you read that article, I learnt a lot from it :) Hope this helps!

I do not know why is it called just "\", to put it a name should i just change the value on the "aspnet_Applications" table?

Anyhow, from the site i posted on my first thread:
"The best way to prevent this from ever happening is to always specify the “applicationName” attribute when declaring your providers. One good default value to use is “/” – which is the root application name"

But heh, let's hope putting the applicationName tag as the last one will fix my problem! :)

Yeah, i will read that article - Thank you mate. :)

in fact the site you posted also says that :P

ok glad to have helped, I hope this fixes your problem. Please remember to mark this thread as solved if it is fixed.

I was hoped, but no good.
Still got the same problem.

Hmm, interesting. I shall investigate more and get back to you a bit later. Good luck in the meantime, really thought that would work. What did you name your app in the end?

I let it "\", that's what it appears in the "aspnet_Applications" table.

What should it be? The name of the Solution in VS2008?

But from those sites, they say setting "\" as application name should fix all those problems..

No, you misunderstood I think, give your app a name like"\applicationname" then in your providers section set your app name to whatever you called it....

Have you tried that yet? I think its the solution...

I tried it, i have an exception now:

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The entry 'AspNetWindowsTokenRoleProvider' has already been added.

Source Error:


Line 40:
Line 41:
Line 42: <add
Line 43:
Line 44: name="AspNetWindowsTokenRoleProvider"

i've put: applicationName="\webvm"
and the same name on "aspnet_Applications" table...

Ok, will have an investigation and get back to you

try adding this to your conn string

<remove name="AspNetWindowsTokenRoleProvider"/>

Like this :

Line 40:
Line 41: <remove name="AspNetWindowsTokenRoleProvider"/>
Line 42: <add
Line 43:
Line 44: name="AspNetWindowsTokenRoleProvider

no luck, still same error :|

The login error i mean

So you have named your app, added in my suggestion in post 16 and you are getting the original login error ?

“Login attempt unsuccessful, please try again.”

Yes :|

almost unbelievable..


I named the app on the table as "\webvm", and put:

<roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
      <providers>

        <remove name="AspNetWindowsTokenRoleProvider"/>
        
        <add
        
        
        name="AspNetWindowsTokenRoleProvider"
        type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
        applicationName="\webvm" />
        
      </providers>
    </roleManager>

We will get it fixed buddy just hang in there! do you have a deadline for this ?

have you tried setting up a new user and logging in with their credits? try it...

Apparently if you didn't set applicationname in the membership provider/rolemanager setting in the web.config, and access your application from different places(e.g. using application running on you local or on the server, even they are using same database) will create different application in the aspnet_applications table. Users created in one place cannot be used in other place.

When trying to add new users in runtime after deployment, i get:


Failed to update database "C:\INETPUB\WWWROOT\SITE\APP_DATA\ASPNETDB.MDF" because the database is read-only.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:\INETPUB\SITE\WWWROOT\ASPNETDB.MDF" because the database is read-only.

But in my VS2008, i can add users without problem.
gonna look for how to solve this error

Check the file attributes in the website directoy. Ensure that the db is not marked read only and that the folder structure that contains it is also not read only. We will get there mate!

EDIT

Also, do this:

1) Make sure App_Data directory or any contained files does not have file system attribute Read-only set.
2) Give user ASPNET and NETWORK SERVICE Modify control over the App_Data directory.
3) Run IISRESET to restart IIS to refresh its permissions. P.S. It is a good idea that you read the below article as restarting IIS can have some negative consequences and should generally be avoided.

Here are some instructions on granting ASPNET and NETWORK SERVICE control permissions:

http://forums.asp.net/t/1221631.aspx

Here is the low down on IISRESET:

http://technet2.microsoft.com/windowsserver2008/en/library/de9ef2d7-22f7-4d02-9189-23b579996e2a1033.mspx?mfr=true

Hope this helps you.

Ok, i could only see that post now, i will give it a go.

I will try to setup a tunnel to the webserver, since it's on a secured lan. Else i will test that monday and get back to you!

Thanks a lot for your help dude!

That's ok, I am just sorry I haven't managed to help you out totally yet. There is still time.....lol. I am deteremined to help fix this one!

Hello mate!

When checking my SQL Server Management i do not see any ASPNETDB.mdf file. I think it's not "seeing" my database on my website.

Is that normal?

I saw that when adding the user"Computer_Name\NETWORK SERVICE" to grant write permissions..

I tryed to add it myself explicitly by doing:

Databases > Attach > Writing_The_Full_Path_for_ASPNETDB.mdf

but i got:

"Failed to retrieve data from this request.
Additional information:

An exception occured while executing Transact-SQL statement or batch.

User 'public' does not have permission to run DBCC checkprimaryfile. (Microsoft SQL Server, error: 2571)"

Hi, does 'public' have full access permissions?
i.e CREATE DATABASE, CREATE ANY DATABASE, or ALTER ANY DATABASE permissions.

Ok, i added a user to the SQL Express with all priveliges. I am now able to browser and attach the ASPNETBD.mdf.

But when clicking the final 'OK' i got:

"Unable to open physical file
c:\inetpub\wwwroot\myWebSite\App_Data\aspnetbd.mdf
operating system error 5: Access denied."

Gonna look on how to set those permissions..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.