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: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:
url = CType(Me.Page, BasePage).FullBaseUrl + value
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:
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("~/", "")
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:
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.