Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Hiding Links in ASP.NET (VB)

Options
  • 08-03-2007 1:05pm
    #1
    Registered Users Posts: 500 ✭✭✭


    how can i hide the href links to there files

    ie : my href points to a wrd doc located on my filesystem c:/program files etc
    how to i hide this?

    it appears in the source and at the bottom of the page when hover over it?

    any tips please?


Comments

  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Why are you linking to a document on the local filesystem? Is this an application for work where all the users will have the same file on their filesytems? If so, then why bother hiding the link?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Set the anchor to runat server and then include a visible attribute set to false. You can do this in the mark up i.e.
    [HTML]
    <a href="http://www.google.com&quot; runat="server" visible="false">Google</a>
    [/HTML]

    If you include an ID you can then control this from the code behind. But as eoin_s why are you doing this in the first place?


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Evil Phil wrote:
    Set the anchor to runat server and then include a visible attribute set to false. You can do this in the mark up i.e.
    [HTML]
    <a href="http://www.google.com&quot; runat="server" visible="false">Google</a>
    [/HTML]

    If you include an ID you can then control this from the code behind. But as eoin_s why are you doing this in the first place?

    Will that not hide the link altogether? I think the OP is looking just to hide the URL in the status bar?

    You can do this by changing the link like so:

    [html]
    <a href="c:\progra~1\file.doc" onmouseover="window.status='download the file'; return true" onmouseout="window.status=''; return true">local word doc</a>
    [/html]

    This doesn't work in firefox. It seems to hide the URL, but doesn't display the message. I believe this is a security issue (you may also have issues with opening a local file through a hyperlink, also for security isssues).

    Also, simply right clicking on the link and getting the properties will show the link.

    If you want to be able to provide a link to a word document, but not allow people to link to it directly - i.e. you want them to access a page first, you could look at first putting the word document in a subfolder of the web application, with an obscure filename, and using a combination of Server.Transfer and mime types to force a download of the file.


  • Registered Users Posts: 2,299 ✭✭✭PixelTrawler


    Surely the link should be http://mysite/docs/mydoc

    You shouldn't ever create the link like c:\mycomputer\docs\mydoc

    If you can't place the docs under you site folder can you create a virtual directory to the docs folder and use this as a http reference.


  • Registered Users Posts: 500 ✭✭✭warrenaldo


    thanks folks.
    its not my problem its the problem of a colleague im just curious.
    she doesnt want the file(its located on the server) to be showing the link/directory path.

    Now from reading around i found that the link is visible in the source.

    I didnt understand why the link was visible - because surely it was in back end code a page.aspx.vb

    but she seems to have her code in the aspx page.

    Im a newbie to aspx. but this seems wrong and maybe the cause of the prob

    However eoins solution seems to be the one that works for me in testing. cheers.


  • Advertisement
  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    eoin_s wrote:
    Will that not hide the link altogether? I think the OP is looking just to hide the URL in the status bar?

    Yep. It'll prevent Asp.net from rendering the link. I assumed he didn't want it in the page source code either.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    warrenaldo wrote:
    I didnt understand why the link was visible - because surely it was in back end code a page.aspx.vb

    but she seems to have her code in the aspx page.

    Im a newbie to aspx. but this seems wrong and maybe the cause of the prob

    You can set the link in the back end alright, but the browser will always need to know where the file is located in order to reach it.


Advertisement