Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 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 26th, 2016, 09:06 PM
Registered User
 
Join Date: Jan 2016
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 13 [p443] Using the GridView and SqlDataSource Controls

So I've done this step successfully, as when I view Genres.aspx in design view I see exactly what I should.
I've even checked the DataSource to see that it can pull records from the Genre table (it can)..

But when I go to run my website, I get these errors:

http://i.imgur.com/8Do3nv1.png

I think some step modified by ~/Web.Config file perhaps?

I don't understand why it's taking exception to this as well, it's always been there since I created the project:
<httpRuntime targetFramework="4.5.1" />

I also couldn't open my .mdf following your steps, I had to go to Server Explorer and navigate to COMPUTERNAME\SQLEXPRESS then select the PlanetWrox database.

Very confused why this isn't working.

Cheers.
 
Old January 26th, 2016, 10:55 PM
Registered User
 
Join Date: Jan 2016
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Now I have this error (I let VS modify my Web.config to allow for debugging):

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

Things you can try:
If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing.
Go to the IIS Express install directory.
Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level.
Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

Detailed Error Information:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x00000000
Requested URL http://localhost:51137/
Physical Path C:\ASPNET Projects\MyASPTestWebsite
Logon Method Anonymous
Logon User Anonymous
Request Tracing Directory C:\Users\Nathan\Documents\IISExpress\TraceLogFiles \MYASPTESTWEBSITE
 
Old January 27th, 2016, 07:19 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,

How many web.config files are there in your site? Is there one located in the root?

Is C:\ASPNET Projects\MyASPTestWebsite the root of the site with its own Default.aspx page? Can you post the code for the web.config file in that folder? And is this also the folder you open in VS as a web site?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 27th, 2016, 08:09 AM
Registered User
 
Join Date: Jan 2016
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I have the following Web.Config

~/Web.config

~/Site/Web.config

~/Site/Management/Web.config

The contents of the files are:

~/Web.config

Code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <connectionStrings>
    <add name="PlanetWroxConnectionString1" connectionString="Data Source=NATHAN-PC\SQLEXPRESS;Initial Catalog=PlanetWrox;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5.1" />
      </system.Web>
  -->
  <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <pages controlRenderingCompatibilityVersion="4.0" />
  </system.web>
    <system.webServer>
        <directoryBrowse enabled="true" />
    </system.webServer>
</configuration>
~/Site/Web.config

Code:
<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" />
  </appSettings>

  <system.web>
    <pages theme="Monochrome">
      <controls>
        <add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx" />
      </controls>
    </pages>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
  </system.web>

  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="REMOVED">
        <network host="smtp-mail.outlook.com" port="587" enableSsl="true" userName="REMOVED"
                 password="REMOVED"/>
      </smtp>
    </mailSettings>
  </system.net>

  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="NameServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />
    <services>
      <service name="NameService">
        <endpoint address="" behaviorConfiguration="NameServiceAspNetAjaxBehavior"
          binding="webHttpBinding" contract="NameService" />
      </service>
    </services>
  </system.serviceModel>
</configuration>
Cheers :)
 
Old January 27th, 2016, 11:38 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Looks like you need to go folder deeper. Site should be the root in IIS and Visual Studio, not your current root.

Check the introduction of the book for a description on how to open the site to prevent this error.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 13: Using the GridView and SqlDataSource Controls phztfte1 BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 2 January 14th, 2016 10:43 AM
Chapter 13 - Genre GridView Antonius Block BOOK: Beginning ASP.NET 4.5 : in C# and VB 1 January 7th, 2014 05:14 PM
conn from Gridview to SqldataSource veda Visual Studio 2005 2 July 9th, 2008 11:49 PM
GridView and SqlDataSource Woes machone3720 ASP.NET 2.0 Basics 1 January 16th, 2007 02:11 PM
Chapter 13 - Creating Your Own Custom Controls msjolin BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 February 16th, 2004 09:01 PM





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