locked
Expression Web 4 parses ~/ path and changes my code RRS feed

  • Question

  • I've been using Expression Web for years, though I'm relatively new to EW4.  I noticed a problem today that I've never had in earlier versions of the program.

    I have a custom tool that allows me to attach a link to a thumbnail image to display the full size image on a page called display.aspx.  The link called display.aspx and requires me to call the image wtih a path starting with ~.  Display.aspx is set to recieve this call and display the full size image.

    <a href="~/display.aspx?imageUri=~/images/nameofimage-fullsize.jpg" runat="server">
    <img alt="" src="../../images/nameofimage-thumbnail.jpg" width="100" height="100" /></a>

    If I work solely in code, I'm OK.  However, what I usually do is double click on the thumbnail in design view to open the Picture Properties. box.  When I open picture properties, EW4 parses the link and hardcodes it like this: file:///C:/WWW/www.nameofsite.com/display.aspx?imageUri=~/images/nameofimage-fullsize.jpg.  It also removes the runat="server".

    Obviously, this causes some major issues when I publish to the server.  EW2 never had this problem - I could easily edit this link in design view.

    Is there some switch or option I can turn off to keep it from messing with my code?

    I uses masterpages and ~ fairly extensively on sites.  Is it going to do this anytime I edit in design view?  Should I go back and work in EW2?

    Thanks for any help.

    Jane

    Thursday, December 22, 2011 11:17 PM

All replies

  • Only time I've ever seen EW change a link to begin with file:///C:/  is when a user has somehow navigated outside of the web root when browsing to link to a file or image.

    Expression Web MVP
    Friday, December 23, 2011 12:09 AM
  • I don't do much dotnet but seems to me that you want to an asp.net control instead of an html anchor since you are using dotnet syntax:

    <asp:HyperLink id="HyperLink1"
    runat="server"
    Height="100px"
    Width="100px 
    ImageUrl="../../images/nameofimage-thumbnail.jpg" NavigateUrl="~/display.aspx?imageUri=~/images/nameofimage-fullsize.jpg"/>

     The only time I know of when EW will hard code a file path is when you are woking on a page outside of a defined local website.


    Free Expression Web Tutorials
    For an Expression Web forum with without the posting issues try expressionwebforum.com
    Friday, December 23, 2011 12:23 AM
  • I tried what you have.  If I the open Picture Properties, EW displays the file://C... path in the Hyperlink physical location box: it's parsing the physical location based on the application root, as the tilda requests it to do. But it doesn't change anything in Code View (at least not for me).  It leaves the original "~" format and doesn't strip out the runat="server".

    Friday, December 23, 2011 2:50 AM
  • Thanks all for your replies.  I'm not sure what to do with it...it's definitely changing the code for me from the Picture Properties box.  It does display the full path in the Physical Location box and that's fine with me...but I can't edit it there or it hard codes it.

    Sucks but I'll likely have to go back to my old EW2 when I use this tool with master pages.

    @ Cheryl - I'm using a custom made tool...I set the first one up in the code just like in the original example I gave.  I copy and paste that bit of code for each picture on the page.  What I used to do (in EW2) is to use the Picture Properties to edit each picture to change just the jpg name.  It was a fast, easy way to manage many pictures.

    Once again...thanks.  Seems that it's not the program, but something specific to what I'm doing.  I'll just have to work around it.

    Tuesday, December 27, 2011 1:55 AM