Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 20th, 2007, 05:51 AM
Authorized User
 
Join Date: Jan 2007
Location: , , .
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


  #2 (permalink)  
Old October 24th, 2007, 09:02 AM
Authorized User
 
Join Date: Jan 2007
Location: , , .
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?

  #3 (permalink)  
Old October 24th, 2007, 07:06 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
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)


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.