|
move from sql server 2000 to 2005
06-16-2008, 01:33 AM
|
move from sql server 2000 to 2005
|
Posts: 70
Name: Nazirul
|
Good Day all !
i have a problem when accessing the database sql server 2005
the error message was :
HTML Code:
{"Cannot open database "SMPB" requested by the login. The login failed. Login failed for user 'BORNEO-007\ASPNET'."}
and the content of web.config :
Code:
<?xml version="1.0"?>
<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><system.web>
<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to insert debugging symbols (.pdb information)
into the compiled page. Because this creates a larger file that executes
more slowly, you should set this value to true only when debugging and to
false at all other times. For more information, refer to the documentation about
debugging ASP.NET files.
-->
<compilation defaultLanguage="vb" debug="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.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<!-- CUSTOM ERROR MESSAGES
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Add <error> tags for each of the errors you want to handle.
"On" Always display custom (friendly) messages.
"Off" Always display detailed ASP.NET error information.
"RemoteOnly" Display custom (friendly) messages only to users not running
on the local Web server. This setting is recommended for security purposes, so
that you do not display application detail information to remote clients.
-->
<customErrors mode="RemoteOnly"/>
<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are "Windows",
"Forms", "Passport" and "None"
"None" No authentication is performed.
"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
its settings for the application. Anonymous access must be disabled in IIS.
"Forms" You provide a custom form (Web page) for users to enter their credentials, and then
you authenticate them in your application. A user credential token is stored in a cookie.
"Passport" Authentication is performed via a centralized authentication service provided
by Microsoft that offers a single logon and core profile services for member sites.
-->
<authentication mode="Windows"/>
<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->
<authorization>
<allow users="*"/>
<!-- Allow all users -->
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>
<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>
<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20"/>
<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
<xhtmlConformance mode="Legacy"/>
<pages>
<namespaces>
<add namespace="Microsoft.VisualBasic"/>
<add namespace="System.Data"/>
<add namespace="System.Drawing"/></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>
<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" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpModules></system.web>
<appSettings>
<add key="SMPBDB" value="Data Source=BORNEO-007\SQLEXPRESS;Initial Catalog=SMPB;Integrated Security=True"/>
<add key="SMAPAN" value="data source=REKOD1;initial catalog=NewSmapan;integrated security=SSPI;persist security info=True"/>
</appSettings>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/></compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/define:Debug=True /define:Trace=True /imports:Microsoft.VisualBasic,System,System.Collections,System.Configuration,System.Data,System.Drawing,System.Web,System.Web.UI,System.Web.UI.HtmlControls,System.Web.UI.WebControls">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom>
<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" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" 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>
the Bold one is the connection to the database. these code was from sql server 2000.
I have replaced
oConn = New SqlConnection(ConfigurationSettings.AppSettings("S MPBDB")) --to--> oConn = New SqlConnection(System.Configuration.ConfigurationMa nager.AppSettings("SMPBDB"))
since the error message that the old command is obsolete
Im using microsoft visual studio 2008 express edition 9.0 with sql server 2005 now but previously im using microsoft development environment 7.0 and sql server 2000.
thanks 
|
|
|
|
06-16-2008, 04:25 PM
|
Re: move from sql server 2000 to 2005
|
Posts: 5,662
Name: John Alexander
|
The connection string looks valid, so I would guess your problem is coming from integrated security. Probably whatever account is running the IIS process doesn't have permission to the database.
|
|
|
|
06-16-2008, 11:12 PM
|
Re: move from sql server 2000 to 2005
|
Posts: 70
Name: Nazirul
|
okay.. i'll check it out how to add the permission to the database.. 
|
|
|
|
06-17-2008, 05:31 AM
|
Re: move from sql server 2000 to 2005
|
Posts: 70
Name: Nazirul
|
im using IIS 5.1 .. and ASP.NET 2.0
IIS > expand Web Site > right click SMPB for Properties > tab Directory Security > in Anonymous access and authentication control go for Edit > Anonymous access ... and browse for ASPNET
is it the correct way? ...
i still get the same error message.
the possibles cause were :
Quote:
This error can take a variety of forms, including:- Login failed for user '(null)'
- Login failed for user domain\username
- Login failed for user computer\ASPNET
The likely cause is that you are working with a Web application and are trying to access a computer running Microsoft SQL Server. The specific error or exception that is raised depends on whether the Web server is also running SQL Server. This problem arises because the Web application is not passing valid credentials to SQL Server. In general, you can resolve this issue by doing the one of the following:- If the Web server is also running SQL Server, give the local ASPNET user login privileges (Windows 2000 and Windows XP) or give the NT AUTHORITY\NETWORK SERVICE login privileges (Windows Server 2003) on the server.
- If SQL Server is running on a remote computer and the Web server is running IIS 6.0, give the Web server's machine account login privileges on the remote computer. The machine account is referenced as DOMAIN\MACHINENAME$.
- Set up ASP.NET to run as a Windows domain user who has login privileges on the computer running SQL Server.
- Use a connection string to use SQL Server standard security. To do this, you must configure the connection string with an explicit user ID and password.
|
how to give the local ASPNET user login privileges ? thanks
|
|
|
|
06-18-2008, 03:41 AM
|
Re: move from sql server 2000 to 2005
|
Posts: 70
Name: Nazirul
|
lol... this does the trick
Quote:
|
<identity impersonate="true" />
|
i have to add it into the web.config file. thanks John for the comment.
reference : http://www.west-wind.com/weblog/posts/295.aspx
|
|
|
|
06-21-2008, 12:00 AM
|
Re: move from sql server 2000 to 2005
|
Posts: 57
Name: Jesse
Location: Phoenix, AZ
|
Quote:
Originally Posted by Nazi370
|
Well I think it may work because its you asking for the page..
Using Integrated Security will expect that the credentials already logged in or that the application is "running as" will have the windows server rights to the SQL database..
<Authentication = "Windows" /> means that your website will look to the passed through windows credentials (Domain/Username password etc) from the browser.. in order to identify you.
Saying <Identity impersonate="true" /> in your asp.net config will basically tell the runtime that it is allowed (or expected) to Impersonate the calling user..
So basically, it probably works because YOU are an admin on the box or have specific authorization on the SQL Server.. but I would expect that when you deploy your app to another server and someone other than you with your Windows credentials logs in, it will be unable to connect.
WHAT I would suggest is one of two things.. you can either Keep windows security, and configure your IIS application to run as a particular user.. or you can add the asp.net / iis user to whatever sql permissions.. not the best idea to add IIS user.. simply because you generally WANT your web app to have the fewest permissions by default..
The other option is to move to a Mixed Authentication MOde in SQL Server which allows the SQL Server to be able to take its OWN usernames and passwords.. this is a pretty typical configuration.. It also allows for a very flexible security model since you can create a user that has only the needed permissions of your website.. thereby not putting yourself at more risk than you have to.
|
|
|
|
06-25-2008, 07:58 AM
|
Re: move from sql server 2000 to 2005
|
Posts: 70
Name: Nazirul
|
hi ..thanks for the information...
i think main problem was using web.config file from visual studio (microsoft Development Environment 7.0 if i am not mistaken) that different than visual studio 2008 express edition
..
this is due to when i create new project, it it not necessary for 'impersonate = true' ...
it just right click on the new project > tab Security and permission for ASPNET ...
i have no such idea on deployment, but if u can explain or any guide it will mean a lots for me since i am new in web programming... i may have to do it tomorrow but having basic on it will make me easier...
thanks RabidSniper
|
|
|
|
|
« Reply to move from sql server 2000 to 2005
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|