Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Need to open .pdf file while click on Hyperlink

Need to open .pdf file while click on Hyperlink

Scheduled Pinned Locked Moved ASP.NET
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    subbu sk
    wrote on last edited by
    #1

    Hai all, i had one hyperlink(click here),while i click on the link i need to open .pdf file which i have in d:/abc.pdf thanks in advance. while i give href...like then the pdf file opens in IE or Firefox. but i need to open .pdf file directly...not in IE or Firefox.

    Thanks Subbu.

    M B 2 Replies Last reply
    0
    • S subbu sk

      Hai all, i had one hyperlink(click here),while i click on the link i need to open .pdf file which i have in d:/abc.pdf thanks in advance. while i give href...like then the pdf file opens in IE or Firefox. but i need to open .pdf file directly...not in IE or Firefox.

      Thanks Subbu.

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      subbu.sk wrote:

      while i give href...like

      As a thumb of rule, href always opens content in broswer.

      subbu.sk wrote:

      but i need to open .pdf file directly...not in IE or Firefox.

      Respose.Redirect("filename");

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      1 Reply Last reply
      0
      • S subbu sk

        Hai all, i had one hyperlink(click here),while i click on the link i need to open .pdf file which i have in d:/abc.pdf thanks in advance. while i give href...like then the pdf file opens in IE or Firefox. but i need to open .pdf file directly...not in IE or Firefox.

        Thanks Subbu.

        B Offline
        B Offline
        Blue_Boy
        wrote on last edited by
        #3

        Did you try to search on google?[^]


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

        V 1 Reply Last reply
        0
        • B Blue_Boy

          Did you try to search on google?[^]


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

          V Offline
          V Offline
          Venkat Eswaran
          wrote on last edited by
          #4

          string filename = System.IO.Path.GetFileName(filepath); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); Response.Flush(); Response.WriteFile(filepath);

          Venky

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups