open text file in browser window using hyperlink

Discussion in 'ASP .Net' started by sohan, Mar 2, 2006.

  1. sohan

    sohan Guest

    hi

    I have hyperlink column in a datagrid. The column contains the name of
    a text file.
    I am able to appendthe full path of the file. The file is on D drive on
    the server. But on clicking on that hyperlink does not open the file.
    When I right click the link, I am able to save the file. I want the
    file to be opne in browser in a new window.

    I started a new webform and used a link
    <a href='file:///D:/Test.txt' id ='hpl' runat='server'>test</a>
    Even here it is not opening the text file. Is there any way to
    hyperlink a text file in local disk on server and open it in a new
    browser window

    Can anybody help me out in this?

    Thanks
    Sohan
     
    sohan, Mar 2, 2006
    #1
    1. Advertising

  2. sohan

    Ward Bekker Guest

    Ward Bekker, Mar 2, 2006
    #2
    1. Advertising

  3. sohan

    Raymond Guest

    Sohan, we went through this once already.
    You can't reference the txt files like that. It's not
    even in your web site folder. And that href doesn't
    even reference your server once it's sent to the browser.

    You create an ASPX page that will stream the text file
    content. I already gave you the code for that. You reference
    that ASPX file in the link, opening it in a new window, and
    pass the text file name via a querystring, which you then
    query and use in that ASPX file to stream.

    It's either that or you need to put those text files in your
    web site folder and reference them directly, using target="_blank"
    in the link.

    "sohan" <> wrote in message
    news:...
    > hi
    >
    > I have hyperlink column in a datagrid. The column contains the name of
    > a text file.
    > I am able to appendthe full path of the file. The file is on D drive on
    > the server. But on clicking on that hyperlink does not open the file.
    > When I right click the link, I am able to save the file. I want the
    > file to be opne in browser in a new window.
    >
    > I started a new webform and used a link
    > <a href='file:///D:/Test.txt' id ='hpl' runat='server'>test</a>
    > Even here it is not opening the text file. Is there any way to
    > hyperlink a text file in local disk on server and open it in a new
    > browser window
    >
    > Can anybody help me out in this?
    >
    > Thanks
    > Sohan
    >
     
    Raymond, Mar 2, 2006
    #3
  4. sohan

    sohan Guest

    Thanks Raymond.
     
    sohan, Mar 2, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Geisenhoff
    Replies:
    1
    Views:
    6,208
    Steven Cheng[MSFT]
    Apr 16, 2004
  2. =?Utf-8?B?SmF3YWhhcg==?=

    Open new window using Javascript or Hyperlink

    =?Utf-8?B?SmF3YWhhcg==?=, May 11, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    15,472
    cicher
    Nov 19, 2008
  3. dana lees
    Replies:
    8
    Views:
    29,166
    vMike
    Apr 20, 2006
  4. Shiperton Henethe
    Replies:
    17
    Views:
    5,402
    Deirdre Saoirse Moen
    May 21, 2004
  5. Replies:
    1
    Views:
    505
    Jan =?ISO-8859-1?Q?Thom=E4?=
    Nov 14, 2006
Loading...

Share This Page