Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 October 20th, 2007, 05:51 AM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with RssReader.ascx user control

Hi.

I have developing a new web site and utilising some of the functionality used in TBH. My code is VB.net but I have followed the Problem Design Solution book where appropriate.

I am using only the Articles Management, Newsletter and RSS features of TBH so have just added the classes that I need into my own namespaces.

My problem is with the RSS Reader user control (RssReader.ascx). The GetArticlesRSS.aspx page works fine and retrieves the information from my db successfully.

However, when I add the RssReader user control to one of my pages I get the following error:

 
Quote:
quote:Unable to cast object of type 'ASP.default_aspx' to type 'Retro.Web.UI.BasePage'


(Retro.Web.UI as per MB.TheBeerHouse.UI)

This is caused by the following code:

VB:
Code:
url = CType(Me.Page, BasePage).FullBaseUrl + value
C#
Code:
url = (this.Page as BasePage).FullBaseUrl + value
To debug further I created a new page and entered the following code on the page load event:

Code:
        Dim value As String = "~/GetArticlesRSS.aspx"
        Dim url As String = value
        If url.StartsWith("/") OrElse value.StartsWith("~/") Then
            url = CType(Me.Page.Master.Page, BasePage).FullBaseUrl.ToString() + value
            url = url.Replace("~/", "")
            Response.Write(url)
        End If


I have passed the RSSFeed Url as I would when declaring the user control and used the same syntax to build the full url and output this to the page. The result is:

 
Quote:
quote:http://localhost:49920/MyWebsite/GetArticlesRSS.aspx


So this works fine.

It seems as if the control is unable to pass a valid value for Me.Page???

Any help would be appreciated. I can get around this for now by making this a none generic control but ideally I would like to use this in some of the subdomains of my site so will need to be able to get the full url.

Thanks,

Ben


 
Old October 24th, 2007, 09:02 AM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can anyone help with this. Anyone else who uses the VB version who has had this problem?

 
Old October 24th, 2007, 07:06 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didn't the rss code yet...

Did you tried to do something like this:

url = http://localhost:49920/MyWebsite/yourpage... + value

?

See it if this works (just for eliminate causes)







Similar Threads
Thread Thread Starter Forum Replies Last Post
ascx control Title SKhna ASP.NET 2.0 Basics 1 March 18th, 2008 12:24 PM
RssReader.ascx.cs error mwalker BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 April 16th, 2007 04:14 AM
Context.User in siteheader.ascx.cs scottf BOOK: ASP.NET Website Programming Problem-Design-Solution 7 November 3rd, 2005 12:52 PM
Include vs. User control(ascx) ajindal General .NET 4 January 8th, 2005 09:40 AM
ascx issue with User.Identity.Name ian.macey Classic ASP Basics 2 June 11th, 2003 02:50 AM





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