Wrox Programmer Forums
|
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2010, 12:29 PM
Registered User
 
Join Date: Jan 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy INSERT permission failed (p 28)

Hey everybody,

I'm trying to get the Insert button to work on p. 28. My code compiles correctly, it just looks like a database error on the back end. What should I be doing with SQL Server? Do I need to add a special user for this application? Do I need to add some permissions inside this application that I've just missed?

Thanks
MC
 
Old February 25th, 2010, 11:28 AM
Wrox Author
 
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts
Default

What is the error message you are getting?
 
Old October 6th, 2011, 04:02 PM
Registered User
 
Join Date: Oct 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Had same issue - stopping me from moving forward.

I have had the same issue. Here are some details.

I created the website as suggested in Ch 1 and went through the steps as carefully as I could.

However, one difference - I created the database in SQLServer 2005 Developer first and ran the script with additional data provided in the FinalDBScriptWithData, so was starting with a precreated database. The database was created to use Integrated Security.

However, for the web site creation, in the Readme.txt of the downloaded code, it states: "When creating the virtual directory in IIS you must disable Annoymous access to the site and enable Integrated Windows authentication."

I checked the settings of the IIS Virtual Dirctory for these and they did not appear to be set by Visual Studio after the solution creation following Ch 1 instructions as the readme stated they should be.

I have tried to run the Ch 2 code both as it was created with Anonymous Access enabled and disabled.

To disable the Anonymous Access, I opened the virtual directory properties dialog from IIS management app, and under the Directory Security tab, clicked the Edit... button to edit the Anonymous access and authentication configuration. I unchecked the "Anonymous access" checkbox and checked the "Integrated Windows Authentication" checkbox.

After going through the creation of the p 28, and selecting view in Browser, I first get a logon dialog though which I log on with my username and password for my local machine (I was surprised to get this...).


Then when I click the button I get the following error message:

Server Error in '/SPSLFF08UI' Application.
--------------------------------------------------------------------------------

Login failed for user 'CHIONA-M6400\ASPNET'.
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: Login failed for user 'CHIONA-M6400\ASPNET'.

Source Error:


Line 40: db.ENTUserAccounts.InsertOnSubmit(userAccount);
Line 41: //Save the changes to the database
Line 42: db.SubmitChanges();
Line 43: }
Line 44: }

Source File: d:\data\Shaw\Projects\source\Test Projects\SPSLFFSolutionVS2008\SPSLFF08UI\Default.a spx.cs Line: 42

Stack Trace:

[SqlException (0x80131904): Login failed for user 'CHIONA-M6400\ASPNET'.]
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +4846887
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.Com pleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Data.Linq.DataContext.SubmitChanges(Conflic tMode failureMode) +331
System.Data.Linq.DataContext.SubmitChanges() +19
_Default.btnInsert_Click(Object sender, EventArgs e) in d:\data\Shaw\Projects\source\Test Projects\SPSLFFSolutionVS2008\SPSLFF08UI\Default.a spx.cs:42
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
 
Old October 6th, 2011, 04:47 PM
Registered User
 
Join Date: Oct 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default One solution that worked.

From a different thread, Login failed for user 'NT AUTHORITY\NETWORK SERVICE' I tried adding the following line to the web.config file in the <system.web> section:

<identity impersonate="true" />

Apparently, even though you can set up both SQL Server to use Windows Authentication and the Website to use Windows Authentication, when the website actually runs, it runs under a different account (the ASPNET account in my case). The instruction above causes it to use the client login as the identity of the process. See http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx and http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx.

This fixed it for me. I don't know if there is a better solution out there - I would have thought that following the instructions in the book were sufficient. Does anybody know of a higher level setting somewhere which might affect this behavior?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 2 pp. 28 mdfinch BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 7 August 24th, 2009 04:34 PM
Urgent - 28# Out of Stack Space narooma.12 Crystal Reports 1 August 27th, 2008 11:16 AM
Chapter 28 code missing rCobbley BOOK: Excel 2003 VBA Programmer's Reference 0 November 1st, 2006 05:42 PM
(0x800A0046) Permission denied,not IIS permission! David Hay Classic ASP Basics 3 April 30th, 2006 10:47 PM
Chapter 28 - downloading assemblies Tangyu BOOK: Professional C#, 2nd and 3rd Editions 0 May 23rd, 2005 10:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.