p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 4 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=560)
-   -   Chapter 19 problem (http://p2p.wrox.com/showthread.php?t=86817)

matthew1412 February 27th, 2012 03:14 PM

Chapter 19 problem
 
Hi

I've just been going through chapter 19 and I think I have come across a problem on the 'Configuring the file system' Try It Out.

My problem is when I go and type http://localhost in my browser, I get nothing but the text and links of the page and none of the styles from before. I'm pretty sure I've done everything, but clearly I've missed something. I know there's not much to go on but the site is just missing the style sheets from what I can see.

I hope you can help

Thanks

Matthew

Imar February 28th, 2012 02:56 AM

Hi Matthew,

If you look in the final HTML in the browser, how does the path to your CSS file look?

Imar

matthew1412 February 28th, 2012 06:46 AM

Hi Imar

The path for the the Styles reads as Styles/Styles.css and the Monochrome path reads as App_Themes/Monochrome/Monochrome.css and the same goes for the DarkGrey theme.

Thanks

Matthew

Imar February 28th, 2012 03:15 PM

Looks alright to me. What happens when you try to access that path directly? E.g. append the /Styles/Styles.css to the current root of the site?

Imar

matthew1412 February 29th, 2012 01:34 PM

I entered http://localhost/Styles/Styles.css in the browser and nothing appeared. It does appear when I include the port number.

Could it have something to do with the security settings? I did have some problems doing the exercises in that my computer wouldn't let me make changes when configuring the file systems. I did fix this problem, but could that have caused this?

Imar February 29th, 2012 01:57 PM

What's the address for the site in your browser? Just http://localhost I assume?

If you add the port number, you're not using IIS but the built-in web server of Visual Studio.

How does your web.config look? Maybe you're blocking access to all content? You could try adding a <location/> element set to the Styles folder and open it up for all users, although you shouldn't have to do this if you followed along with the book.

Cheers,

Imar

matthew1412 March 1st, 2012 10:44 AM

Yeah I am trying to access it with the http://localhost address but no luck.

I've arranged my web.config file to look like your version. I have tried re-doing chapter 19 and I get the same result. Which file would I put <location/> in? I will give that a try.

Thank you

Matthew

Imar March 1st, 2012 01:22 PM

Hi Matthew,

Can you post the code of your web.config?

Imar

matthew1412 March 2nd, 2012 11:23 AM

Hi Imar

Here is the web.config file for my Release version of the site

Matthew

<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="FromAddress" value="johndolf123@gmail.com" />
<add key="FromName" value="John" />
<add key="ToAddress" value="johndolf123@gmail.com" />
<add key="ToName" value="Matthew" />
<add key="SendMailOnError" value="false" />
</appSettings>
<connectionStrings>
<add name="PlanetWroxConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\PlanetWrox.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
<add name="PlanetWroxEntities" connectionString="metadata=res://*/App_Code.PlanetWrox.csdl|res://*/App_Code.PlanetWrox.ssdl|res://*/App_Code.PlanetWrox.msl;provider=System.Data.SqlCl ient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirector y|\PlanetWrox.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=En tityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.web>
<trace mostRecent="true" enabled="false" requestLimit="100" pageOutput="false" localOnly="true" />
<customErrors mode="On" defaultRedirect="~/Errors/OtherErrors.aspx" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="~/Errors/Error404.aspx" />
</customErrors>
<profile>
<properties>
<add name="FirstName" />
<add name="LastName" />
<add name="DateOfBirth" type="System.DateTime" />
<add name="Bio" />
<add name="FavouriteGenres" type="System.Collections.Generic.List`1[System.Int32]" />
</properties>
</profile>
<roleManager enabled="true" />
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>
<authentication mode="Forms" />
<pages theme="MonoChrome">
<controls>
<add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
<buildProviders>
<add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesig nerBuildProvider" />
</buildProviders>
</compilation>
</system.web>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="Matthew &lt;johndolf123@gmail.com>">
<network enableSsl="true" userName="johndolf123@gmail.com" password="*******" host="smtp.gmail.com" />
</smtp>
</mailSettings>
</system.net>
<location path="Management">
<system.web>
<authorization>
<allow roles="Managers" />
<deny users="*" />
</authorization>
</system.web>
</location>
<location path="MyProfile.aspx">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
<location path="ManagePhotoAlbum.aspx">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
<location path="NewPhotoAlbum.aspx">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

Imar March 3rd, 2012 01:12 AM

I copied this code into my Planet Wrox web site and it worked fine. So I can't really tell what the problem is without understanding more of your setup such as IIS settings, folders and so on.

Cheers,

Imar


All times are GMT -4. The time now is 12:03 PM.

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