Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : 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 March 29th, 2011, 07:30 AM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default Errors on Try It Out pg 624-626

Hi Imar,

I'm getting these weird error once I typed in the Try It Out on pg 624-626:

Error 1 Newline in constant c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 2 Too many characters in character literal c:\Users\Lee\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 3 Newline in constant c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 4 Too many characters in character literal c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 5 Invalid token ''\u0031'' in class, struct, or interface member declaration c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 6 Invalid token '{' in class, struct, or interface member declaration c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 7 Invalid token ''\u0031'' in class, struct, or interface member declaration c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 8 A namespace cannot directly contain members such as fields or methods c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 9 Type or namespace definition, or end-of-file expected c:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\App_Code.frnqkqdl.5.c s
Error 10 'ProfileCommon' does not contain a definition for 'LastName' and no extension method 'LastName' accepting a first argument of type 'ProfileCommon' could be found (are you missing a using directive or an assembly reference?) C:\BegASPNET\Site\MyProfile.aspx.cs 13 17 C:\BegASPNET\Site\

Any ideas why?

I assume App_Code.frnqkqdl.5.cs is the file create automatically by the Profile?

Last edited by TeaDrinkingGeek; March 29th, 2011 at 07:55 AM..
 
Old March 29th, 2011, 07:43 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Any ideas why?
Not without seeing the code or configuration that causes this.

Quote:
I assume App_Code.frnqkqdl.5.cs is the file create automatically by the Profile?
Probably. Or some other generated file created on the fly. Open it up in Visual Studio if you're curious to see what it contains.

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!
 
Old March 29th, 2011, 07:48 AM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
Open it up in Visual Studio if you're curious to see what it contains.
The file is not there under App Code folder. Can I regenerate it using the web.config?

I found a file called profile.cdcab7d72.cs under C:\Users\L\AppData\Local\Temp\Temporary ASP.NET Files\site\0c026ce8\65046bfb\Sources_App_Code

It has FirstName and LastName in the code.

Last edited by TeaDrinkingGeek; March 29th, 2011 at 07:55 AM..
 
Old March 29th, 2011, 09:19 AM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Wouldn't be a SP1 error would it?
 
Old March 29th, 2011, 10:29 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Wouldn't be a SP1 error would it?
It could be, but it's still hard to tell without seeing your actual code and configuration for Profile that lead to 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!
 
Old March 29th, 2011, 03:37 PM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Code.

Web.config

Code:
<?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>
  <connectionStrings>
    <add name="PlanetWroxConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\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.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\PlanetWrox.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.web>
    <profile>
      <properties>
        <add name="FirstName" />
        <add name="LastName" />
        <add name="DateOfBirth" type="System.DateTime"/>
        <add name="FavouriteGenres" type="System.Collection.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="false" 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.EntityDesignerBuildProvider" />
      </buildProviders>
    </compilation>
  </system.web>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="Lfe &lt;[email protected]&gt;">
        <network enableSsl="true" userName="[email protected]" password="kdjdjdjdjdjsjd" host="smtp.gmail.com" />
        <specifiedPickupDirectory pickupDirectoryLocation="C:\TempMail" />
      </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>
</configuration>
MyProfile.aspx

Code:
<%@ Page Title="My Profile" Language="C#" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="MyProfile.aspx.cs" Inherits="_MyProfile" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
    <h1>My Profile</h1>
    <p>The My Profile page allows you to make changes to your personal progile.  For now
    , all you can do is change your password below.</p>
    <asp:ChangePassword ID="ChangePassword1" runat="server">
    </asp:ChangePassword>
</asp:Content>

MyProfile.aspx.cs

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _MyProfile : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Profile.FirstName = "Your first name here";
        Profile.LastName = "Your last name here";
    }
}
 
Old March 29th, 2011, 04:00 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, there we have it:

Code:
 
<add name="FavouriteGenres" type="System.Collection.Generic.List'1[System.Int32]"/>
There are two mistakes here: Firstly, it's Collections (plural). Secondly, in List`1 you shouldn't be using a single quote but a back-tick On my keyboard it's left to the 1 key.

See how useful posting code can be? ;-)

Cheers,

Imar

P.S. Good thing you removed your password from the code you posted, but slightly too late for those with an e-mail subscription to this forum, such as me and Mr. Henry ;-)
__________________
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!
The Following User Says Thank You to Imar For This Useful Post:
ich (May 31st, 2012)
 
Old March 30th, 2011, 04:30 AM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default

It works thanks.

I'll change my password, ;-)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pg 118 DyerOppenheimer BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 6 February 18th, 2011 12:31 AM
Compiler errors - Example on pg. 347-349 yoav_zohar BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 1 December 31st, 2009 02:00 PM
Can't get errors to display with <html:errors> michaeldill JSP Basics 0 August 2nd, 2004 01:47 PM
errors and fixing errors Droopy XML 0 August 26th, 2003 12:47 AM
Errors Errors DB Errors Ljhopkins VS.NET 2002/2003 0 July 15th, 2003 12:42 PM





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