Wrox Programmer Forums
|
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
 
Old August 9th, 2006, 09:40 AM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Wrox Blog Modification - Chapter 6

Hello,

I recently the book ASP.NET 2.0 Instant Results and I'm really finding it very useful as someone who is relatively new to ASP.NET web development.

I was trying to modify the blog application and include it on my website as I thought the design was simple and excellent.

I created a page blog.aspx and dragged the UserControls unto the page laid out in CSS and tested it.It was fine as the blog entries displayed.

When I try to log in as an Administrator so I can enter and update entries, I'm authenticated alright but the program tries to find the default.aspx page to load the Blog managing area hence posting an application error as I don't have a Default.aspx page.

I want the Blog managing area (ie the panel that displays the area to post new entries) to load into the same Blog.aspx page since having a Default.aspx page will interfere with my index.html on the hosting server.

I've tried to look into the code to find out why the application keeps redirecting me to the Default page but having some difficulty.

Will really appreciate your help.

Meanwhile, I have hosted the modified blog with a hosting company and it seem fine but when I log in to create a new entry or edit an existing entry, it doesn't come up with the buttons to click. It however works just fine on my development computer. Is there something I have to set in the config file or something?



Thanks a lot
 
Old August 9th, 2006, 05:34 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Bit in a hurry so I don't have the time for a long answer. Will try to give you one over the weekend. Send me an e-nail through my Profile page or my website if I haven't responded by Monday.

In the mean time, look at the authentication node in the web.config file and add an defaultUrl element like this:
Code:
<authentication mode="Forms">
  <forms loginUrl="~/Login.aspx" defaultUrl="YourPage.aspx"  />
</authentication>
Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 10th, 2006, 04:25 AM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,
Thanks Imar.

I will try this and let you know by email how it goes.



 
Old August 11th, 2006, 12:11 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did it work for you?

Anyway, the reason this might work is this:

By default, when you login there are a few ways to determine where to redirect the user to. One is programmatically, in the code behind for the login page. This is common, but ties you to a fixed page name.

Another is to set the URL on the Login control. A bit easier to see / maintain, but it still ties you to a single page which may be hard to discover or change.

The final option is to let the ASP.NET framework handle it. IMO, this is the best way, because it's pretty flexible and doesn't require you to browse through code and see where the page is defined. By default, the .NET run-time returns you to ~/Default.aspx after a successful login. A sensible default, but not in your case. Setting the defaultUrl attribute in the web.config allows you to determine where the user is redirected to after a login.

This was the longer answer I had in mind; hope it's working for you....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 12th, 2006, 08:16 AM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

I tried what you suggested but it didn't quite work. Its still keeps defaulting to the default.aspx page but since its just an add on to my website ie (when you click the blog link, it will take you to this application) it's not so much of a problem now that I think about it.

My major problem now is that when I log in as Administrator, I don't get access to the option that enables you to create new blog entries and edit existing ones now that I have moved it unto a live hosted SQL 2005 Server.

With the help of my hosting companies support desk, I think I have done what I need to do.

From the Command line, I executed the aspnet_regsql.exe -S -U -P -A all -d parameeter with all the specific details to set up the shema, updated the connectionstring in the web.config file, used the ASP.NET Configuration to set up users, roles and assigned allow rule for the Administrator.

When I go to the site and log in as the user with administrator rights, I'm authenticated alright, but cannot see the buttons to create and edit blog entires.

I read you artilce on your site about the differece in using SQL Express 2005 and the full blown one, followed the link to Scott Guthrie's blog as well and read what he said and I thought I was applying the same principles.

Is there something I may have missed in the points I've stated earlier? I desperately want to see this work and I think I've come very close.

I would appreciate any insight with your experience.

Thanks

 
Old August 12th, 2006, 08:35 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think this has to do with the role the user is assigned to.

I think your user account exists so you can log in successfully. However, it's probably not assigned to the correct roles.

How did you assign your account to the admin role at your live server?? When you like in the aspnet_* tables (Membership, Roles, UserRoles, Application etc) what do you see?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 12th, 2006, 11:11 PM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your were right. I had set up everything but I hadn't assgined a user to the Admin role. I thought I had done that when I created the account and ticked the Admin role but obviously there was something I didnt' do. I used the ASP.NET Configuration Tool to set up the account

The support desk of the hosting company also said the same thing so they assigned the user to the Admin account and its now working perfectly.

You mentioned the aspnet_ * tables ...... How do I check that so I can track that in future? Should use the Server Management Studio? Which tables should I be looking at?

You guys are doing a great job and thanks for your support

Dougydoe

 
Old August 13th, 2006, 06:01 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Dougydoe,

Those tables should be visible when you view the database with Server Management Studio. The tables are created in your database when you use the aspnet_regsql tool or when you have an automatically created Express database.

There are a number of tables, and all start with aspnet_. For example, aspnet_Users keeps tracks of the users in your system and aspnet_UsersInRoles links your users to specific roles in the aspnet_Roles table.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old August 13th, 2006, 06:49 PM
Registered User
 
Join Date: Aug 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Imar,

Thanks for the leads. I will try them out and add this knowledge to my arsenals in the future






Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrox Blog in C# madAlan BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 22 June 12th, 2011 04:09 AM
Wrox Blog tblessed23 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 16 May 14th, 2007 04:08 PM
Wrox Blog: Viewing individual blog entries Tawanda BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 7 May 7th, 2007 12:06 PM
FCKeditor in wrox blog nakori BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 June 11th, 2006 02:48 AM
Wrox Blog Admin addstravel BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 April 23rd, 2006 05:41 AM





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