views:

15

answers:

1

Hi!

My client request a flash header for his website. I'm using asp.net and a master page (where the code for the flash header is). My problem is that whenever I go to a page that's not in the website's root, the flash doesn't appear. I've had the same issue with pure css menus on this site...

Here's the code:

    <div id="header">
        <!--[if !IE]> -->
        <object type="application/x-shockwave-flash"
          data="App_Themes/Default/banner1.swf" width="1000" height="400">
        <!-- <![endif]-->

        <!--[if IE]>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
          codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
          width="1000" height="400">
          <param name="movie" value="App_Themes/Default/banner1.swf" />
          <embed src="App_Themes/Default/banner1.swf" width="1000" height="400"></embed>
        <!--><!--dgx-->
          <param name="loop" value="true" />
          <param name="menu" value="false" />

          <p></p>
        </object>
        <!-- <![endif]-->
    </div>

As you can see, I'm not calling the path to the flash object relative to the website root (in case this isn't clear... if it were an asp.net control, I'd use ~/App_Themes/Default/banner1.swf")

The flash object is being loaded relative to the location of the current page that's being viewed on the website. Assuming an indeterminate folder depth from root, how can I change the code to load the flash relative to the root, rather than the current page?

I have considered changing the path that's being used by perpending / or ~/ to it, but this only results in the flash not loading on any page at all. Looking at the source code, the server modifies /App_Themes/Default/banner1.swf to ~/App_Themes/Default/banner1.swf

A: 

Sticking a ~/ in a plain URL won't work. Try using this:

<object type="application/x-shockwave-flash"
    data="<%=ResolveUrl('~/App_Themes/Default/banner1.swf')%>"
    width="1000" height="400">
Andrew Koester
No improvement, but the result translates to: `data="\\192.168.1.13\Users\Logan\Documents\Visual Studio 2008\WebSites\Clients\RFInvestments\App_Themes\Default\banner1.swf"`. The flash still doesn't display on any pages
Logan Young
@Logan Whoops, my bad. It's `ResolveUrl` not `MapPath`. Fixed my answer.
Andrew Koester
@Andrew I'm accepting your answer because it was immeasurably helpful. It has to be made clear though that the solution isn't `Server.ResolveUrl`, it's `Page.ResolveUrl`. Thanks for the help :-)
Logan Young