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

matthew1412 March 4th, 2012 09:24 AM

Hi Imar

I was thinking it might have something to do with the security settings. I have retried doing the sections where you set the permissions and still does not work. So it must just be my computer that's the problem.

I had a look at the security tab for the app_themes folder, it says that it's being inherited from the release folder in the C: drive. Should this be like that or should it say <not inherited> like the app_data folder?

Thanks

Matthew

Imar March 4th, 2012 03:58 PM

That depends on the settings it's inheriting.... :-)

Did you grant access to the web site's folder for the account used by IIS?

Imar

matthew1412 March 7th, 2012 02:02 PM

Hi Imar

I believe I have how would I go about checking to be sure?

Thanks Matthew

Imar March 7th, 2012 03:03 PM

Hi Matthew,

Using a Windows Explorer, bring up the properties for the folder (e.g. C:\BegASPNET\Release) and see which account you configured and which permissions it has. Then do the same for the App_Data folder.

Cheers,

Imar

zhmhang March 10th, 2012 07:39 AM

I also have got this problem, and the pictures in folder GigPics did't show as well. Using the built-in server, it works fine. I do not know what's the matter.

Imar March 10th, 2012 07:47 AM

Hi zhmhang,

Can you describe your setup? E.g. version of Windows, the location of your site on disk, how you setup IIS, the security account you're using, the permissions you applied, how you browse to the site and so on?

Cheers,

Imar

zhmhang March 10th, 2012 07:58 AM

My OS version is Windows 7, the site locates in C:\BegAspnet\release, I exactly followed the steps of the book. I've check all folders and documents, and the security account is just the same as the book. I used the Chorme Browser. And I found my web.config is similar with Matthew's.But when I install the IIS, I only selected the Asp.Net feature. PS:Sorry,I'm not from an English-Speaking country.

Imar March 10th, 2012 08:00 AM

Quote:

PS:Sorry,I'm not from an English-Speaking country.
Neither am i... ;-)

Quote:

I've check all folders and documents, and the security account is just the same as the book
Sure, but somehow something is wrong, so something must be different.

Which account did you configure? Which permissions did you give it? And how do you browse to the site?

Imar

zhmhang March 10th, 2012 08:06 AM

Hi Imar.

The account is ASP.NET v4.0, the permission is list folder& read. I typed http://localhost to browse. The problem is the theme didn't work, and the pictures didn't show. The rest of the site worked fine.

matthew1412 March 10th, 2012 08:47 AM

Hi Imar

I've looked at the permissions for the Release folder and the permissions given to the Username ASP.NET v4.0 Release folder are, List folder contents and Read. The permissions for the App_Data has everything but Full Control ticked.

Thanks

Matthew

Imar March 10th, 2012 03:30 PM

In that case, I am not really sure what's going on on both of your machines. Are you familiair with a tool called Fiddler? http://fiddler2.com/fiddler2/

Try running your site with Fiddler enabled. It may tell you why some files don't work (e.g. it'll show you if you get a 404 or 500 exception for example).

Cheers,

Imar

matthew1412 March 19th, 2012 08:50 AM

Hi Imar

I've tried out that fiddler program and I was getting a 404 error message from a favicon.ico file, so i just quickly made one and put it in the Release folder but that did not solve the problem.

The results that I am getting from localhost are HTTP 200 and 304. From what I can see its not throwing any errors.

Thanks

Matthew

Imar March 19th, 2012 11:43 AM

In that case, I really know what's going on. 200 and 304 are OK; 200 means success, while 304 means that the browser already has a valid copy of the file.

Are you seeing requests for the CSS files from the theme?

One thing to check: when you installed IIS, did you also install "Static content" under Common HTTP Features?

Imar


All times are GMT -4. The time now is 01:50 PM.

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