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

  • SEARCH
  • Home
  • 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 7006723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:30:51+00:00 2026-05-27T21:30:51+00:00

Have been getting pretty bald over this situation! I am using MS VS 2010

  • 0

Have been getting pretty bald over this situation!

I am using MS VS 2010 C# ASP.NET, and MS SQL EXPRESS 2008, IIS 7 on Windows 7.

I have the asp.net login control on a page. It works quite flawlessly in development environment.

When I move the site to IIS, the login aspx page is displayed and all seems to be working fine. As soon as I put in my login credentials (which have been tested on the same database in MS VS Dev server) and click login, I am presented with an IIS error that states I do not have permission. (Please see stack trace)

I have done some digging, and read that when MSVS creates the database for the login control, it gives permissions to the current user. Therefore, when we move this to our production server (its not really a server, its just IIS on one of our win 7 machines to test) and try to login via the internet, it seems as if IIS_IUSRS does not have permissions.

Things I have tried

1: Detaching the database from the solution, attaching it in SQL Server Manager, and trying to set the permissions there. Couldn’t recognize IIS_IUSRS account at all. (I tried computer name / IIS_IUSRS too). This probably makes sense since IIS_IUSRS is not really a windows account. I also had the same issues trying to give permissions for NT AUTHORITY.

  1. I was thinking if I could somehow create the database from IIS_IUSRS it will automatically figure out the plumbing for me, but wasn’t sure where to start here, or if thats possible.

stack trace

This is my connection string that I am using to connect to the db:

  <connectionStrings>
    <remove name="ApplicationServices"/>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=True;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
  </connectionStrings>

Any help is greatly appreciated, I have been stuck for quite some time now.

  • 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-27T21:30:52+00:00Added an answer on May 27, 2026 at 9:30 pm

    This may be a little specific, but there are most surely some solutions for others in this mix. Here is what I had to do to port my asp.net website from a Development environment (MS VS 2010, SQLEXPRESS) to IIS 7.

    What this will explain, is how to set up two web application under one website (Website1, and Website2). Website1 will use aspnetdb.mdf (created by visual studio) and Website2 will use website2 database which was manually created in MS SQL Server 2008. We will be porting the aspnetdb.mdf to sql server 2008 as well for ease of manipulation.

    Website1 will also have permissions to create files and directories on website2.

    Section 1 IIS Setup

    ****Step 1:****
    create a new folder in wwwroot to hold both applications (We called it websites)
    Copy paste “WebSites” folders for website2 and website1.

    Step 2:
    App pool for website1
    If not already created, create the Application pool and configure it to use .NET framework 4.0, Integrated pipeline mode, we called it asp4.

    App pool for website2
    Currently uses App pool for website1

    Step 3:

    Add website1
    In IIS MANAGER, add new website. Point its physical directory to website1 that we just copied into the new folder on the root (Section 1, Step 1).
    Select the application pool for website1, See Section 1, step 2.
    We set the site name the same as the physical directory (website1).

    Verify other requirements, Section 2 website1 DB Setup and IIS folder permissions.

    Add website2
    In IIS Manager, right click the new website application we just created, select “Add Virtual Directory”.
    Set the physical path to the website2 folder that we copied to our new folder on the wwwroot holding both applications, See Section 1, step 1.
    Convert to application and select the application pool for website1, See Section 1, step 2.
    We set the alias to the same as the physical path folder, website1.

    Currently, there are no connection requirements to pass through.
    Verify other requirements Section 3 – website2 Database setup for website2

    Section 2 website1 DB Setup and IIS folder permissions

    Step 1 aspnetdb.mdf adjustments:
    Note: From now on will probably just use most recent aspnetdb.bak file.

    Attach aspnetdb.mdf into ms sql server by rightclicking database’s and attaching DB.

    Step 2 – IIS User logon
    If user is not set up – Section 4, Step 1 Create a DB Logon for the IIS USer

    if permissions not setup – Section 4, Step 2 Setting Permissions for the IIS USER on the db

    Code Adjustments / Verifications
    need to remove user instance variable (;User Instance=true) auto generated in connection string by MS VS in web.config.

    -    <remove name="ApplicationServices"/>
    -          Not 100% neccessary but this will make it more scalable accross platforms
    -       In the web.config, make sure we are using the database we attached /        restored on MS SQL Server.
        -     "data source=.\SQLEXPRESS;Integrated Security=SSPI;initial catalog=aspnetdb" (because we renamed it aspnetdb)
    

    Section 3 – website2 Database setup for website2

    Make sure DB is restored on MS SQL SERVER
    Database requirements

    Step 1

    If user is not set up – Section 4, Step 1 Create a DB Logon for the IIS USer

    Step 2

    if permissions not setup – Section 4, Step 2 Setting Permissions for the IIS USER on the db

    Step 3 Folder permissions (after child site website2 is added)

    Set folder permissions : Since website1 writes files and creates folders in website2, (its set up to be always looking in the parent folder for website2 folder) we need to give server IIS_IUSRS , ours is (IIS_IUSRS(MIKE71\IIS_IUSRS) permissions.

    From within IIS, rightclick the nested application website2 and select edit permissions. Ensure that modify and write priveledges are checked off for IIS_IUSRS.

    Section 4 – Adding IIS user to databse and giving permissions

    Step 0 Attaching and restoring the Databases

    • If the database is not already attached to MS SQL Server, we need to attach the .mdf file.
    • We can restore the database by rightclicking Databases, restoring to our Attached Database, and restore from supplied .Bak file.
    • If having troubles restoring because of database definitions (creating a clean one from scratch) try:
      RESTORE DATABASE trimweb
      FROM DISK = ‘C:\trimweb.bak’
      WITH REPLACE

    Step 1 Create a DB Logon for the IIS USER

    Why? Need create and allow IIS APPOOL\asp4 user to have permissions to databse, set as data reader (the application pool created in Section one, Step 2)

    How: In the security section in MS SQL SERVER, need to right click users and add IIS APPPOOL\asp4 (IIS APPPOOL\apppoolname, created in Section one, Step 2).
    Add IIS 7 AppPool Identities as SQL Server Logons

    Step 2 Setting Permissions for the IIS USER on the db

    Right click on the database name, (website2 db) and click properties. In permissions section add your APPPOOL user that you just created in Section 4, Step 1, be sure to give him Execute and Select permissions.

    Note: Website1 needs Execute, Select, Delete, Insert permissions as well. Website2 is also using this app pool which it shouldnt be because we dont not need to alow the user to have that kind of functionality from within the trimdynamics application. We could seperate the app pools so that our trim dynamics IIS USRS is only getting Execute and Select permissions.

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

Sidebar

Related Questions

I have been using Visual Studio 2008 quite long but lately I am getting
This should have been pretty straightforward using the DOM but I seem to be
I am new to ASP.NET MVC and I have been able to figure pretty
I have been getting an error in VB .Net object reference not set to
I use an sql server regularly and have recently been getting frustrated by the
I have a ASP.net MVC2 website that was working great when using Visual Studio
I have been developing a library that is getting pretty large, and now I
i have been pretty pleased so far with this plugin, but am having a
I've been creating this pretty large web application for sometime and have been updating
I have been getting a number of attacks on my website lately, with a

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.