Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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 October 11th, 2007, 05:44 PM
Authorized User
 
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding products to webshop not working.

I can't add products to the webshop. I can add users. Im not sure whats wrong please help.

Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1309
Date: 10/11/2007
Time: 2:26:30 PM
User: N/A
Computer: U15221477
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 10/11/2007 2:26:30 PM
Event time (UTC): 10/11/2007 9:26:30 PM
Event ID: f3ffafc3a6174228ae219829765ff13d
Event sequence: 3
Event occurrence: 1
Event detail code: 0

Application information:
    Application domain: /LM/W3SVC/84888900/Root-11-128366115901299175
    Trust level: Full
    Application Virtual Path: /
    Application Path: D:\www\webshop\
    Machine name: U15221477

Process information:
    Process ID: 2572
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:
    Exception type: SqlException
    Exception message: Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Request information:
    Request URL: http://www.carefreejewelry.com/Shop/Default.aspx
    Request path: /Shop/Default.aspx
    User host address: 72.222.174.128
    User: mcarol44
    Is authenticated: True
    Authentication Type: Forms
    Thread account name: NT AUTHORITY\NETWORK SERVICE

Thread information:
    Thread ID: 1
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace: at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.Com pleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at ShopManagerDB.GetProducts(Int32 categoryId) in D:\www\webshop\App_Code\DataAccess\ShopManagerDB.v b:line 163
   at ShopManager.GetProductList(Int32 theCategoryId) in D:\www\webshop\App_Code\BusinessLogic\ShopManager. vb:line 104
   at ShopDefault.LoadData() in D:\www\webshop\Shop\Default.aspx.vb:line 35
   at ShopDefault.Page_Load(Object sender, EventArgs e) in D:\www\webshop\Shop\Default.aspx.vb:line 28
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Custom event details:



 
Old October 12th, 2007, 01:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at page 307 and 308. It explains how to configure the Pictures folder used in the shop. You need to do the same for App_Data and its databases.

Did you resolve the other issues? Some feedback would be nice...

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old October 12th, 2007, 11:17 AM
Authorized User
 
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I have the gotten in at Administrator. Thank you for your help. 1 question regarding the Administrator password is that I see the Administrator user but I don't see that password stored in any databases. Where is that being stored. As for this issue here is what I'm seeing if I install the application and use the virtual directory than I can get it to work but I if I point my url to the root and use this site as the default then I get redirected back to the login page when I try to access the management folder. If I remove adminstrator entry in the webconfig then I can access the Management folder but I can't make any changes to the database in the management folder. How can I make the webshop the root of the url and still have the management capabilities work correctly. Please let me know.
Thanks,

Matt






 
Old October 13th, 2007, 03:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi again,

The data is stored in a database inside your App_Code folder. This database gets generated for you automatically. Some of the applications in the book reconfigure the database in the web.config to explicitly point it to a database and not rely on auto generation.

To fix your problem regarding a root based site, you need to set the applicationName to something like / and then reconfigure your users. Search this forum for posts from me with applicationName in their text.

Cheers

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old October 16th, 2007, 07:08 PM
Authorized User
 
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I seem to be struggling a little bit with getting the site to run at the default root site. If I don't have a virtual directory I can't seem to get the site to run correctly. Here is my webconfig file do you see anything wrong. Also, I would like to get the site working off the database in Express and not using the database files. What changes do I have to make in the webconfig and the code to make that happen. Please let me know.

<?xml version="1.0"?>
<!--
    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>
  <appSettings>
    <add key="MailFromAddress" value="You@YourProvider.Com" />
    <add key="ConfirmationMessageLocation" value="~/StaticText/ConfirmationMessage.txt" />
    <add key="ConnectionString" value="server=(SQLEXPRESS);Initial Catalog=WEBSHOP.MDF;uid=sa;pwd=get1td0ne" />
  </appSettings>
  <system.web>
    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
      <properties>
        <add name="FirstName" />
        <add name="LastName" />
        <add name="ProfileCompleted" type="System.Boolean" />
        <group name="Address">
          <add name="Street" />
          <add name="ZipCode" />
          <add name="City" />
          <add name="Country" />
        </group>
      </properties>
    </profile>
    <membership>
      <providers>
        <clear />
        <add connectionStringName="LocalSqlServer" enablePasswordRetrieval="False"
          enablePasswordReset="True" requiresQuestionAndAnswer="True"
          applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed"
          maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression=""
          minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0"
          name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>
    </membership>
    <roleManager enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES"
      defaultProvider="SqlProvider">
      <providers>
        <add connectionStringName="LocalSqlServer" name="SqlProvider"
          type="System.Web.Security.SqlRoleProvider" />
      </providers>
    </roleManager>
    <!--
            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"/>
    <pages>
      <namespaces>
        <clear/>
        <add namespace="System"/>
        <add namespace="System.Collections"/>
        <add namespace="System.Collections.Specialized"/>
        <add namespace="System.Configuration"/>
        <add namespace="System.Text"/>
        <add namespace="System.Text.RegularExpressions"/>
        <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>
    </pages>
    <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Forms"/>
    <!--
            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>
        -->
  </system.web>
  <location path="Management">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>
  <location path="Shop/CheckOut.aspx">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="smtp.YourProvider.Com" port="25"/>
      </smtp>
    </mailSettings>
  </system.net>
</configuration>


 
Old October 17th, 2007, 01:18 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

In order to receive useful help, please be as specific with your questions as you can be. I really can't provide any advice for this:
Quote:
quote:I can't seem to get the site to run correctly
What is "not correctly"? Does it turn blue on Tuesdays? Does it yell at you? Don't you see anything at all?
Please provide info about how you set up the site, where files are located, how IIS is configured, the error messages you may get and so on.

Same applies to this:
Quote:
quote:I would like to get the site working off the database in Express and not using the database files
I can't make head or tails of this. Express does use database files, so I can't understand what you're asking here.

Please elaborate, or expect replies with a vagueness identical to your questions...

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old October 17th, 2007, 10:51 AM
Authorized User
 
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK sorry for being so vague. Here is out delimma. I have added the webshop database to sql express 2005 and I would like to get the webshop program to connect to that database instead of using the database that is located in the App_Data directory. I have repointed my webconfig and AppConfiguration.vb file to point to that database but I keep getting this error when I try to login.

Cannot open database "WEBSHOP" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
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: Cannot open database "WEBSHOP" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Cannot open database "WEBSHOP" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.]

Do you know what I am doing wrong. I have provided my updated webconfig file below.

<?xml version="1.0"?>
<!--
    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>
  <appSettings>
    <add key="MailFromAddress" value="You@YourProvider.Com"/>
    <add key="ConfirmationMessageLocation" value="~/StaticText/ConfirmationMessage.txt"/>
  </appSettings>
  <connectionStrings>
    <add name="WebShop" connectionString="server=(local)\SqlExpress;Integr ated Security=true;Database=WEBSHOP;User Instance=true;Initial Catalog=WEBSHOP"/>
  </connectionStrings>
  <system.web>
    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" connectionStringName="WebShop" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
      <properties>
        <add name="FirstName" />
        <add name="LastName" />
        <add name="ProfileCompleted" type="System.Boolean" />
        <group name="Address">
          <add name="Street" />
          <add name="ZipCode" />
          <add name="City" />
          <add name="Country" />
        </group>
      </properties>
    </profile>
    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="WebShop" enablePasswordRetrieval="False" enablePasswordReset="True" requiresQuestionAndAnswer="True" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0"/>
      </providers>
    </membership>
    <roleManager defaultProvider="SqlProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
      <providers>
        <add name="SqlProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="WebShop"/>
      </providers>
    </roleManager>
    <!--
            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"/>
    <pages>
      <namespaces>
        <clear/>
        <add namespace="System"/>
        <add namespace="System.Collections"/>
        <add namespace="System.Collections.Specialized"/>
        <add namespace="System.Configuration"/>
        <add namespace="System.Text"/>
        <add namespace="System.Text.RegularExpressions"/>
        <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>
    </pages>
    <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Forms"/>
    <!--
            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>

  </system.web>
  <location path="Management">
    <system.web>
      <authorization>
        <allow roles="Administrator"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="Shop/CheckOut.aspx">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="smtp.YourProvider.Com" port="25"/>
      </smtp>
    </mailSettings>
  </system.net>
</configuration>



 
Old October 17th, 2007, 01:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, that really helps. Take a look here:

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=395

BTW, no need to repeat your web.config with every post. Adds a lot of noise.....

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
The Following User Says Thank You to Imar For This Useful Post:
Denno Secqtinstien (October 16th, 2012)
 
Old October 18th, 2007, 08:19 PM
Authorized User
 
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I have reinstalled the webshop as the root site and have ensured that the applicationName is to "/" but when I log in as Administrator I do not see the Admin tab at the top the site. When I try to access the Management folder I am redirected to the login page. When I install the webshop as a virtual directory (ie.webshop) the Admin page works great and Im not redirected to the login page when I logon as Administrator. Can you tell me what I'm doing wrong in the webconfig file to set the webshop as the default site. Also, what *.vb files to I have to modify to fix this within the code as well. Please let me know.


Thanks,

Matt

 
Old October 19th, 2007, 12:53 AM
Authorized User
 
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why do I have two Administrator accounts in my aspnet_users table is this part of the problem. Please let me know.

023080b3-0876-481f-a68d-772ce4918e84 73ce1d85-eec4-4d38-8d02-32b5679c2c62 Administrator administrator NULL False 12/6/2005 9:51:17 PM
4c0aa065-21b4-4b08-b0fa-87b6bd0b00e0 d25b30d4-f770-4a85-a9aa-d2e0780a8681 Administrator administrator NULL False 10/19/2007 5:32:31 AM






Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding products to a shoping cart Guerra BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 4 March 16th, 2009 10:15 AM
Adding Color and Size parameters to WEBSHOP Cart. DJPrice BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 March 10th, 2008 01:39 PM
Adding update feature to Webshop mcarol44 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 January 4th, 2008 12:53 PM
Webshop adding tables. Rebel BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 25 October 28th, 2007 09:28 AM
Updating Products in the WebShop ASPLee BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 March 10th, 2007 11:24 PM





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