none
Error 404 when trying to launch aspx page in Silverlight 4 web project

    Question

  • Greetings,

    My solution was created using the Silverlight Business Application template.

    I have added an aspx page to the web project in my solution and want to launch it from a button_click event in a Silverlight page but I get Error 404: IE cannot display web page.  This is on my local machine during testing.

    The physical location of the page is:
    D:\My Documents\Visual Studio 2010\Projects\CMS\CMS.Web\MyPage.aspx

    The click event basically does this:

     

    string serverPath = "http://localhost:50346/CMS/CMS.WEB/";
    string uri = serverPath + "MyPage.aspx";
    Uri printUri = new Uri(uri);
    HtmlPage.Window.Navigate(printUri, "My Window Name","top=0,left=0,resizable=1,status=no,width=1050,height=700");
    


    I have Asp.Net projects that I can test and debug fine on this machine but this is the first time I have tried to add an aspx page to a silverlight project.

    Any help would be greatly appreciated.

    Monday, July 11, 2011 3:07 PM

Answers

  • Try this.

    Dim myPath = App.Current.Host.Source.AbsoluteUri.Replace("Clientbin/Test.xap", "MyPage.aspx")

    this url would be...    http://localhost:50346/MyPage.aspx

    HtmlPage.Window.Navigate....


    if this doesnt work when you run your application try to browse to that page and grab the exact url and try replacing it with the mypath replace string.


    and looks like you dint specify the urikind. specify it as absolute. it will work.

    Monday, July 11, 2011 3:19 PM

All replies

  • Try this.

    Dim myPath = App.Current.Host.Source.AbsoluteUri.Replace("Clientbin/Test.xap", "MyPage.aspx")

    this url would be...    http://localhost:50346/MyPage.aspx

    HtmlPage.Window.Navigate....


    if this doesnt work when you run your application try to browse to that page and grab the exact url and try replacing it with the mypath replace string.


    and looks like you dint specify the urikind. specify it as absolute. it will work.

    Monday, July 11, 2011 3:19 PM
  • Thanks for your help SilverKali...

    Sunday, July 17, 2011 1:34 PM