Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old August 10th, 2012, 03:33 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Can you show the code for the BasePage? Something is wrong there, but it's a tad hard to say what without seeing the code... ;-)

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!
Reply With Quote
  #12 (permalink)  
Old August 10th, 2012, 03:57 PM
Authorized User
Points: 57, Level: 1
Points: 57, Level: 1 Points: 57, Level: 1 Points: 57, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2012
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default

and also i get another error when i enterd in this code

<profile>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
<add name="DateOfBirth" type="System.DateTime"/>
<add name="Bio"/>
<add name="FavoriteGenres" type="System.Collections.Generic.List'1[System.Int32]"/>
</properties>
This code seen below seems to be the problem, because when i take it out its fine.

<add name="FavoriteGenres" type="System.Collections.Generic.List'1[System.Int32]"/>

SORRY SORRY SORRY! anyway here is the error.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC32042: Too few type arguments to 'System.Collections.Generic.List(Of T)'.

Source Error:


Line 38: End Property
Line 39:
Line 40: Public Overridable Property FavoriteGenres() As System.Collections.Generic.List'1
Line 41: Get
Line 42: Return CType(Me.GetPropertyValue("FavoriteGenres"),System .Collections.Generic.List'1)

Source File: C:\Users\Video Editor 1\AppData\Local\Temp\Temporary ASP.NET Files\root\d148c986\74f07afa\App_Code.y6zo1r6r.5.v b Line: 40


Show Detailed Compiler Output:

Show Complete Compilation Source:


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Reply With Quote
  #13 (permalink)  
Old August 10th, 2012, 04:27 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Take another look at the section that explains how to add the Generic.List`1 to the web.config. It's not

Code:
 
Generic.List'1
but
Code:
 
Generic.List`1
with a backtick (usually found next to the 1 key on the keyboard).

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!
Reply With Quote
  #14 (permalink)  
Old August 10th, 2012, 04:42 PM
Authorized User
Points: 57, Level: 1
Points: 57, Level: 1 Points: 57, Level: 1 Points: 57, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2012
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default BasePage

Here you go.

Imports Microsoft.VisualBasic

Public Class BasePage
Inherits System.Web.UI.Page

Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Dim PreferredTheme As HttpCookie = Request.Cookies.Get("PreferredTheme")
If PreferredTheme IsNot Nothing Then
Page.Theme = PreferredTheme.Value

End If
If Me.Title = "Untitled Page" Or String.IsNullOrEmpty(Me.Title) Then
Throw New Exception(
"Page title cannot be ""Untitled Page"" or an empty string.")
End If
End Sub

End Class

Thanks for that last post! i did not evan know what a backtick was!
Reply With Quote
  #15 (permalink)  
Old August 10th, 2012, 04:56 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You may want to take a look at both exercises as you're now mixing up things. Checking the title should go in PreRender, setting the theme should go in PreInit.

That doesn't explain this error so this may not be the actual code you're using? Try comparing your code with the version that comes with the book.

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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Caden11998 (August 29th, 2012)
  #16 (permalink)  
Old August 15th, 2012, 06:04 PM
Authorized User
Points: 57, Level: 1
Points: 57, Level: 1 Points: 57, Level: 1 Points: 57, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2012
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Talking Completed the book!

I got all the errors fixed and finished the book for the second time! Thanks for all your help! I did have a couple of questions that I hoped you could answer though. Question 1: do you have any html 5 boiler plate type suggestions? is there a specific html 5 tag I should worry about that maybe aspnet 4 doesnt cover for mobile and cross browser compatibility or otherwise? Question 2: Is there a way in aspnet 4 to re-size a users uploaded picture? For example, say a user submits a photo on my site that's 3000px by 3000px wide. Is there a way to shrink it so it doesn't slow my site down? really appreciate your help!

Thanks,
Caden
Reply With Quote
  #17 (permalink)  
Old August 17th, 2012, 02:10 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Re 1: all browsers implement different parts of the HTML5 standard. Testing is really the only way to find out what works and what doesn't. Most modern browsers support the new tags introduced in HTML 5 and you can use a script library called Modernizr for support in older browsers.

Re 2:My book ASP.NET 2.0 Instant Results shows you how to resize images. You could get a copy of the book, or just download its source from the website. Also, Google has lots of examples on resizing images in .NET.

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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2:Dialog project "force close" error ichthus BOOK: Beginning Android Application Development 4 May 16th, 2011 11:16 AM
Chapter 15. "Sign Up for new account" gets error: 26 - Error Locating Server/Instance Tanya Roslyakova BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 March 8th, 2011 10:34 AM
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
Chapter 18: Getting "Failed to generate a user instance of SQL Server" error HungryCaterpillar BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 November 11th, 2009 01:56 PM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM



All times are GMT -4. The time now is 07:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.