none
what does ~"tilde" mean?

    Question

  • in aspx pages, what does ~ mean?

    like

    <%@ Register TagPrefix="wssuc" TagName="MUISelector" src="~/_controltemplates/MUISelector.ascx" %>

    Friday, April 20, 2012 5:08 AM

Answers

All replies

  •  Tildes like that appear in the "short name", a special version of file and directory names that's compatible with old DOS programs.

    Regards

    Senthil

    Friday, April 20, 2012 5:13 AM
  • '~' here in SharePoint master pages or page layouts refers to the site url or site collection url. SharePoint interprets this symbol into site url.

    Thanks Arut

    Friday, April 20, 2012 5:15 AM
  • You're looking at an ASP.NET token, the ~ stands for the path relative to the application root. SharePoint has it's own url tokens. Check out this: http://www.sharepoint-insight.com/2008/12/01/list-of-sharepoint-url-tokens/ They are basically shortcuts which avoid typing work, you should get to know the ones listed in the url as well. Also check out http://stackoverflow.com/questions/337781/creating-custom-url-tokens-in-asp-net-a-la-moss


    Kind regards,
    Margriet Bruggeman

    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com


    
    
    Friday, April 20, 2012 5:22 AM
  • In the above case ~ means the relative address of the SharePoint site.

    Hope this helps!!!


    Please "Mark As Answer" if my post solves your problem or "Vote As Helpful" if a post has been helpful for you.

    Friday, April 20, 2012 5:28 AM
  • Thank you.

    thoses tokens are only effective in aspx server side tags?

    in aspx.cs

    this works fine.

    SPList list = web.GetList(SPContext.Current.Web.Url.Replace(SPContext.Current.Site.RootWeb.Url, "") + "/Lists/Project%20Info/");

    this won't work.

    SPList list = web.GetList( "~site/Lists/Project%20Info/");


    • Edited by Ronaldo.K Friday, April 20, 2012 7:13 AM
    Friday, April 20, 2012 7:09 AM
  • Hey,

    "~" means the address to the Application root basically.

    For Example : If you explore your master Page ,Their is one entry for SiteLogoUrl="~site".

    Basically it will navigate to your homepage.

    And yes those are applicable in aspx server side tage only.You can't use them in client side :)

    Hope this helps :)


    "The Only Way To Get Smarter Is By Playing A Smarter Opponent"

    Friday, April 20, 2012 7:12 AM
  • Yes, there's once specific case to keep in mind: it is commonly used in web parts in the SharePoint ScriptLink control. You'll use that one frequently doing SharePoint development.

    Kind regards,
    Margriet Bruggeman

    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

    Friday, April 20, 2012 8:07 AM