Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 233545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:06:41+00:00 2026-05-11T20:06:41+00:00

I have an application which connects to a database, retrieves a username from a

  • 0

I have an application which connects to a database, retrieves a username from a user’s table and matches it against the username retrieved with System.Security.Principal.WindowsIdentity.GetCurrent.Name

On my localhost, everything works fine. The database exists on the development server but the application lies on my localhost. All of my authorization and authentication techniques are running smoothly.

However, when I publish my application to the development server, I’m faced with the following error.

Cannot open database requested in login 'databaseName'. Login fails.
Login failed for user 'DevelopmentServerName\ASPNET'. 

I can’t put my finger onto what would cause this. Any help would be greatly appreciated.

Thanks!

Edit: Here is the connection string!

  <add name="connectionStringName" connectionString="Initial Catalog=myDatabase;Data Source=DevelopmentServerName;Integrated Security=True"
     providerName="System.Data.SqlClient" />

Also, for context. This authentication needs to grab the user’s Windows username and match it against the username in the database. Users will have the Computername\Myname username built into the database (if they are authorized to use the required section of the program, that is).

Thanks again 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:06:41+00:00Added an answer on May 11, 2026 at 8:06 pm

    It appears that your application is attempting to connect to the database under the ASPNET account, which may have limited permissions on the development server, as opposed to logging in on your own (you local machine may actually be using your windows identity). I can see two potential solutions.

    1. Make sure to add into the system.web section of your web.config file.

    2. Check with the system administrator and the SQL administrator to make sure the ASPNET account has proper authorization to connect to the database, if indeed your environment allows this account to connect.

    Adding some additional code to your question, such as your connection string may help things out as well.

    EDIT:
    Okay, you are indeed using IntegratedSecurity, so typically with this kind of setup (using impersonation), you need to make sure you are getting prompted to add your Username and Password to authenticate against.

    We have a similar setup, and to do this, we have to go to the IIS settings for the virtual directory, select the Directory Security tab, and click the Edit button under Anonymous access and authentication control.

    Make sure Anonymous access is unchecked, and you may will most likely need to enable the proper authentication for your environment. Unfortunately we’re still using Basic authentication (clear text) here, but Integrated Windows authentication may will work for you too. It depends on your environment.

    I’m adding this comment to the main post since this seemed to have done the trick…

    I just found this post which may help you get the proper configuration setup to handle what you need based on your IIS environment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Django Model which retrieves 3 records from a database. The
I currently have an application which uses EF database first which was built against
I have an Java desktop application which connects directly with the DB (an Oracle).
I have an application which extracts data from an XML file using XPath. If
I have an application which takes a string value of the form %programfiles%\directory\tool.exe from
I have developed a Windows application in .NET which uses a SQL Server database
We have a WPF application which gets data from an Analysis Services Cube. The
I have a C# .net winforms application with two forms which connects to sql
I have a third party .Net web application (Sitecore) which connects to an Oracle
Hi everyone i have one question i.e. i have some database table's which are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.