Solved

asp.net - authentication issues with website

Posted on 2011-09-07
10
510 Views
Last Modified: 2012-05-12
I have a website and the user kands on a login page, basically its a access issue, with anonymous access, etc
I am using IIS7, windows server 2008, ms sql server 2005 its all new on a new server, and Ima trying to hook it up so that the login page will find the user account on db and if exists, redirect them...

at one point I got this error:

Login failed for user ' '. The user is not associated with a trusted SQL Server connection.

so I tried this link:

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22397792.html?sfQueryTermInfo=1+10+30+associ+connect+fail+login+server+sql+trust+user

I went to the features in the IIS7:
Anonymous Access Enabled
ASP.NET Impersoantion Enabled
Basic Authentication Enabled
Digest Authentication Disabled
Forms Authentication Enabled
Windows Authentication Enabled

the impersanation= true is in the webconfig file

anything I need to do to ms Sql server 2005?

I added the
IUSR_<SERVERNAME>
HVU_<SERVERNAME>
to the sql security login as an account..I enabled roles simliar to the ms sql server on another DB that is set correctly..gotta be don the IIS7 side as this is an upgrade for us...
0
Comment
Question by:GlobaLevel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
10 Comments
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36500195
the user currently adds their login info and its not hitting the db....in one case I had to add false:
Response.Redirect("Home.aspx",false)

just to get it to redirect..odd...appreciate the helpas I need to get this up and running as soon as possible
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36500251
when I remote desktop to the server and run the app locally on the server...I get the same result as the client gets thru the interent...however if I step thorugh the code line by line...it works?!?!
0
 
LVL 4

Accepted Solution

by:
asp_net2 earned 500 total points
ID: 36500355
Sounds like it may even have to do with your web.config file which needs your username/password and SQLServer Name for authentication. Can I see your web.config file to further assit?
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 11

Expert Comment

by:Sanjay Santoki
ID: 36501557
Hello,

Please be sure you have both SQL authentication and windows authentication is enabled on the SQL server.

For further, do you have static database crated in SQL or using dynamic database (user instance)?

Thanks,
Sanjay Santoki
Byte Technosys
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36504129
i will get the.webconfig...

How do I enable both sql authtnetion and windows auth on the SQl server again?
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36504368

For further, do you have static database crated in SQL or using dynamic database (user instance)?

>>> not sure what you mean....


In the security tab I get:
database role membership for: myclientdb


isnt suppose to be:
database role membership for: aspnetdb
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36504391
i would think it has to do with the sql/iis..not sure how the webconfig would factor in...I could comment out the persanl info and aspte it hjere...but thats alot of work...
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36504424
here is the web.config with the personal info out...but i dont think the problem is here and the sql server is set to mixed mode...
<?xml version="1.0" encoding="UTF-8"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
	<configSections>
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
					<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>
	<appSettings>
	<add key="com.ABCCOMP.www.webservice1" value="https://www.ABCCOMP.com/webservice1.asmx" />
	</appSettings>
	<connectionStrings>
  <add name="ABCCOMPConnectionString" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString2" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString3" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString4" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString5" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString6" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString7" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString8" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString9" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString10" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString11" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString12" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString13" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString14" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="ABCCOMPConnectionString15" connectionString="Data Source=ABCCOMP__MYSERVER;Initial Catalog=ABCCOMP;Integrated Security=True" providerName="System.Data.SqlClient" />
 </connectionStrings>
	<system.web>
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
		<compilation debug="true" strict="false" explicit="true">
			<assemblies>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
			</assemblies>
		</compilation>
		<pages>
			<namespaces>
				<clear />
				<add namespace="System" />
				<add namespace="System.Collections" />
				<add namespace="System.Collections.Generic" />
				<add namespace="System.Collections.Specialized" />
				<add namespace="System.Configuration" />
				<add namespace="System.Text" />
				<add namespace="System.Text.RegularExpressions" />
				<add namespace="System.Linq" />
				<add namespace="System.Xml.Linq" />
				<add namespace="System.Web" />
				<add namespace="System.Web.Caching" />
				<add namespace="System.Web.SessionState" />
				<add namespace="System.Web.Security" />
				<add namespace="System.Web.Profile" />
				<add namespace="System.Web.UI" />
				<add namespace="System.Web.UI.WebControls" />
				<add namespace="System.Web.UI.WebControls.WebParts" />
				<add namespace="System.Web.UI.HtmlControls" />
			</namespaces>
			<controls>
				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
				<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			</controls>
		</pages>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
		<authentication mode="Windows" />
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
		<httpHandlers>
			<remove verb="*" path="*.asmx" />
			<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
		</httpHandlers>
		<httpModules>
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
		</httpModules>
        <identity impersonate="true" />
	</system.web>
	<system.codedom>
		<compilers>
			<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5" />
				<providerOption name="WarnAsError" value="false" />
			</compiler>
			<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5" />
				<providerOption name="OptionInfer" value="true" />
				<providerOption name="WarnAsError" value="false" />
			</compiler>
		</compilers>
	</system.codedom>
	<!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
	<system.webServer>
		<validation validateIntegratedModeConfiguration="false" />
		<modules>
			<remove name="ScriptModule" />
			<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
		</modules>
		<handlers>
			<remove name="WebServiceHandlerFactory-Integrated" />
			<remove name="ScriptHandlerFactory" />
			<remove name="ScriptHandlerFactoryAppServices" />
			<remove name="ScriptResource" />
			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
		</handlers>
	</system.webServer>
	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
			</dependentAssembly>
			<dependentAssembly>
				<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
			</dependentAssembly>
		</assemblyBinding>
	</runtime>
</configuration>

Open in new window

0
 
LVL 4

Expert Comment

by:asp_net2
ID: 36504650
First of, why do you have 15 connection strings for the same DataSource? You only need one Connection String to your DB. It appears that you are using Windows Authentication to your SQL Box. Have you tried using SQL Authentication for the Connection String?

Also, take a look at the following links below that explains this more.

http://support.microsoft.com/kb/555332
http://support.microsoft.com/kb/889615

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

or

<add name="YourName" connectionString="Data Source=nameofyourDB;Initial Catalog=databasename;User ID=sa;Password=yourpassword" providerName="System.Data.SqlClient"/>

Hope this helps!!
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36506417
Hi asp_net2,

I have done all of the above and still the app does not connect to the db...
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question