 |
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
 | This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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
|
|
|
|
|

March 11th, 2011, 09:01 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Wrox Blog gives error while running in ASPnet 4.0
Hi, I do not know whether I should post this inside ASPnet 4.0 or here in Instant Results, so i will give it a try. Recently i bought the Instant results book and was now trying to look into Wrox Blog.
I took the coding from the CD and put it inside VS 2010, changed the web.config so that de Access DB was used. The first result was that i got the starting page, could login, but did nog get the button Create New Entry nor Editing the two items that are inside could be done, due to no button to do so.
What I do see is an error in the Design in default.aspx under blog entries:
Error Rendering Control - pnlAddEditBlogEntry - An unhandled exception has occured. Request is not available in this context.
I do not understand what this means exactly, maybe you can help me.
Also in the book is mentioned that only 2 setting in Web.config should be done to use MS Access, I only changed add key defaultConnectionString to AccesConnnectionString. What is the other change?
Thanks in advance.
|
|

March 11th, 2011, 09:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Are you running the site under IIS? If so, try setting the Application Pool to "Classic" mode instead of Integrated mode. .NET 4 has stricter rules about accessing Request during start up events, and it looks like the code has a "bug" that prevents this from working correctly under .NET 4. I'll look into this, but it might take some time so for now the IIS work around hopefully is enough.
With regards to the settings: I can't recall the exact text from the book (and don't have it here to check), but you need to change the DefaultConnectionString setting in appSettings, and update the actual connection string to match your database. Finally, you need to modify the connectionStringName attributes of the various providers such as Membership and Roles in web.config to point to your Access connection string.
Hope this helps,
Imar
|
|

March 13th, 2011, 09:35 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I just ran the site under IIS in .NET / Integrated mode and it ran fine without errors.
When do you get the error and how did you set up the site?
Also, the Access login mechanism used in this site won't be compatible with other ASP.NET Access Membership databases. For this book, I created a custom security mechanism. To see how that works, take a look at the UserManagerDB class. You could remove all Access specific stuff from this project and replace it with the Access Membership provider I blogged about in the past.
Cheers,
Imar
|
|

March 14th, 2011, 09:42 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Error Rendering Control
Hi Imar, When i make an empty website in VS 2010 (with ISS 7.5) and then copy all the files from chapter 6 of your book to it, including overwriting the starting web.config, then i do see in the split mode of VS 2010 the following error message:
Error Rendering Control - pnlAddEditBlogEntry. An unhandled exception has occured. Request is not available in this context.
I can still build the website without any error message but running it in Localhost i do see the website, but without any button to do something with the text.
I did not add any other file than the ones in chapter 6 and also made no changes to any of these. Any clues ?
regards, Wim
|
|

March 14th, 2011, 10:17 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
By dragging the existing web.config into your project, you're overwriting some settings. To fix it, follow these steps:
1. Open the Property Pages for the web site and switch to the Build category
2. Switch the target framework drop down to version 3.5.
3. Click OK
4. Repeat these steps, but now switch it back to 4.0.
By switching from 3.5 to 4.0 in the last step, Visual Studio adds the necessary information to the web.config file to make the site work correctly under .NET 4.
For the roles issue, try this:
First, add an applicationName set to / to the role provider in web.config:
Code:
<add connectionStringName="SqlServerConnectionString" name="SqlProvider" type="System.Web.Security.SqlRoleProvider" applicationName="/" />
Then in Visual Studio, choose Website | ASP.NET Configuration.
Next, create a role called Administrator and assign the Administrator account to that role.
Finally, log out from the blog and log in again. That puts you in the Administrator role and gives you the Create buttons back.
Hope this helps,
Imar
|
|

March 14th, 2011, 11:28 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
switching does not help
In windows I took all coding out off the blog map and took the coding from the CD again and put this into the map Blog again. So coding was teken from chapter 6 under Source.
I then opened the website in VS2010 and did the switch to Framework 3.5 and back again to 4.0. That did not took away the error in the Design nor Split mode. Still having Error rendering control.
I do not know whether or not this error is important and should be solved, befor continuing with the other point you gave. Is the erro important or should i forget this?
|
|

March 14th, 2011, 11:55 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hard to say, as it works for me this way, so I don't know what issues you'll run into
Do you have additional attributes on the <pages /> element in web.config targeting .NET 3.5?
Imar
|
|

March 14th, 2011, 12:23 PM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
these are the pages elements
No Imar, I did not add anything to the site that was not in the coding area of the book.
These are the pages elements:
<pagescontrolRenderingCompatibilityVersion="3.5"clientIDMode="AutoID"> <namespaces>
<clear/> <addnamespace="System"/> <addnamespace="System.Collections"/> <addnamespace="System.Collections.Specialized"/> <addnamespace="System.Configuration"/> <addnamespace="System.Text"/> <addnamespace="System.Text.RegularExpressions"/> <addnamespace="System.Web"/> <addnamespace="System.Web.Caching"/> <addnamespace="System.Web.SessionState"/> <addnamespace="System.Web.Security"/> <addnamespace="System.Web.Profile"/> <addnamespace="System.Web.UI"/> <addnamespace="System.Web.UI.WebControls"/> <addnamespace="System.Web.UI.WebControls.WebParts"/> <addnamespace="System.Web.UI.HtmlControls"/> </namespaces></pages>So i'm lost
|
|

March 14th, 2011, 12:24 PM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
now see that at pages still 3.5 is mentioned
I now see that in pages 3.5 still is mentioned. is that correct?
|
|

March 14th, 2011, 12:37 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
I now see that in pages 3.5 still is mentioned. is that correct?
|
Yes, that's correct. Those are the additional attributes I was referring to in my previous post. It's the stuff that gets added when you switch from 3.5 to 4 and helps to avoid backwards compatibility issues. This changed fixed the error in Design VIew for me.
Cheers,
Imar
|
|
 |