 |
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
|
|
|
|
|

August 2nd, 2012, 02:52 PM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Configuration Setting, <% %>, email tool
Hi Omar,
A couple questions relating to configuration setting:
Q1: On page 699, Under Expression Syntax you show how to get the Copyright statement from the App Setting in Config.sys using the <%$ %> expression. While that works, I liked your suggestion for indirect access to the config settings by declaring a new class, AppConfiguration.
By copying the FromAddress property and making all the necessary changes, I now have a new property, which I named, CopyrightOwner.
Now my intent was to incorporate that copyright statement in the master page footer section using one of the <% %>, e.g. <%, <%=, <%$, or <%# ---- but all seem to fail.
At this point, I simply used a statement in the Page_Load handler that invokes the property and assigns it to the Text attribute of the Literal and --- that works.
Nonetheless, for reasons of a more readable code, I'd rather make use of one of the inline constructs, <% %> -- which makes it clear to the code reviewer what is being provided here.
Can you provide the inline code which uses one of the <%%> constructs to access CopyrightOwner property?
Q2: The emails that we have produced so far from the server are rather simple text messages. How do you incorporate a richer email, one that incorporates graphics, formatting, etc.
Any suggestions, tools or books on how to do that?
Thanks for your help,
Michael
P>S> a wonderful book -- wide, in depth and clear coverage, very few if any mistakes in the code or text-- much more than a beginner's level. One thing that could improve the book for the use by beginners is to incorporate a specification header at the top of each TIO -- such that the reader is able to try it on his own first or after (e.g. second pass) -- and only if necessary look at your solution.
Last edited by mkaftor; August 2nd, 2012 at 02:58 PM..
|
|

August 3rd, 2012, 03:28 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Michael,
>> Hi Omar
Omar? Who's Omar? My name is Imar.... ;-)
>> Can you provide the inline code which uses one of the <%%> constructs to access CopyrightOwner property?
There's no built-in support to make that work. You could build your own ExpressionBuilder as explained here: http://www.4guysfromrolla.com/articles/022509-1.aspx Inside the builder you could use reflection to look at your AppConfiguration class and return the value of a property whose name matches that of the requested key. Not very simple or straightforward, but it can be done.
>> A ny suggestions, tools or books on how to do that?
Take a look at this thread that shows you how to create HTML formatted e-mail messages:
Chapter 9 Email Question
Simply put you need to do this:
1. Use HTML in the mail template file
2. Make all URLs absolute. E.g. when linking to images, use http://www.domaionname.com/images/someimage.png instead of /images/someimage.png
3. Use "old-skool" HTML as that tends to be interpreted better than modern CSS.
4. Set IsBodyHtml to true when sending the e-mail.
Searching Google for "e-mail html guidelines" or something like that should bring up some guides with the dos and don'ts of HTML formatted e-mail.
>> such that the reader is able to try it on his own first or after
>> and only if necessary look at your solution.
Interesting suggestion. The "solution" here being the actual steps of the TIO?
I just finished the first draft of the new version of the book (for ASP.NET 4.5) so it's too late for that version to include this....
Cheers,
Imar
|
|

August 6th, 2012, 10:18 PM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Configuration Setting, <% %>, email tool
Hi Imar,
Sorry for mispelling your name.
1) Question about CopyOwner property of AppConfiguration class :
You must have misunderstood my question. Actually, the next day, I tried it again and it was rather easy; here is the line I was looking for:
HTML Code:
<h6 class="Copyright">Copyright of <%= AppConfiguration.CopyrightOwner%> ©</h6>
Aparently, despite its name and contrary to what I assumed, the <%= %> expression will not take anything more complicated than a function or var name (I tried to place a string concatenate expression inside it) -- but one can do the same outside, as my line demonstrates.
For a complete and consistent solution, you may want to incorporate that line and the property in your BegASP.NET 4.5 book.
2) The code that you have on p702/top, for the Shared ReadOnly property, is a bit confusing -- because you elected to place the "else" part of the If statement outside, after it. Wouldn't it be more readable to use: If ... Then ... Else ... End Else construct?
3) Thanks for the additional info about HTML-based emails. I have not tried it out yet, and will let you know if I run into additional problems.
4) About the specification for each TIO -- it may not be too late. why don't you include them in the resources folder that is being downloaded -- a great bonus to those buying the book.
5) And since we talk about the new version of the book, it would had been nice to have a one chapter discussion on the architecture and page design phases of the site before proceeding into implementation --- some suggested books, methodologies and tools that you recommend?? In particular, any RAD tool that will allow the documentation of the page design?
Thanks for you comments,
Michael Kaftor
P>S> no matter what, yours is one of the better, take it back, best books.
|
|

August 7th, 2012, 03:57 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
1) I didn't want to mention this as this does something completely different. This is *not* expression binding syntax. <%= %> is short hand for Response.Write which outputs directly into the page response. It works for the scenario you described but doesn't work for data binding inside a data bound control for example.
2) This is a matter of preference. It's quite common to have code like this when the code above it already exits the method. This way you can avoid unnecessary nesting. IMO, it makes it very clear that beyond that point (after End If) no code can execute anymore.
5) I already have trouble controlling the size of the book ;-)
Cheers,
Imar
|
|

August 7th, 2012, 02:08 PM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 21
Thanks: 0
Thanked 1 Time in 1 Post
|
|
an introduction to Web site planning, tools and methodologies
You said:
"5) I already have trouble controlling the size of the book ;-)"
My answer:
... but you write so well -- just a short introduction to the subject with some references to pursue, as the reader finds it necessary -- and it's always possible to include the additional material in the online Resource folder. It would be a shame not to include this chapter in the book which is otherwise so good and better -- and not make it the best.
May be you can place some of your favorit refrences here, as a reply to my question?
Can you post here a MS Project template for implementing a web site?
Michael Kaftor
|
|

August 7th, 2012, 02:14 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
May be you can place some of your favorit refrences here, as a reply to my question?
|
I don't have any recommendations for references that come to mind....
Quote:
|
Can you post here a MS Project template for implementing a web site?
|
This is a book for developers, not project managers.... ;-)
Cheers,
Imar
|
|
 |
|