Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 5th, 2005, 04:39 PM
Authorized User
Join Date: Jun 2003
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default linkbutton control

When I set a hyperlink with this control pointing to a file on the server it fails to find the file except when the page is run from the server. Here is the snippet

<asp:LinkButton id="LinkButton11" runat="server" OnClick="LinkButton11_Click">Open File</asp:LinkButton>

The code behind is this

Public Sub LinkButton11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton12.Click

Dim frame1 As HtmlControl = CType(Me.FindControl("iframe1"), HtmlControl)
frame1.Attributes("src") = "d:\Data\Issues\Ext Nos.pdf"

End Sub

I would be grateful for any ideas.


  #2 (permalink)  
Old December 6th, 2005, 02:30 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

If I'm browsing your web application from my computer (which doesn't have a D: drive), how will my computer ever find "d:\Data\Issues\Ext Nos.pdf"? As far as my browser is concerned, it is looking for that file locally.

You'll need to build a page that takes the desired file name as a querystring argument (viewfile.aspx?file=d:\Data\Issues\Ext Nos.pdf) and reads that file and feeds back the binary data of that file. The only other option is to put the files in a disk location that is accessible thru your web server. Then you can provide the browser the web relative address to the file. For example:

1. Either put the files in a folder of the web application, or create a virtual directory that points to the server's physical location of those files:
   Virtual directory in the root of the web server called "data" that points to "D:\data" on the web server.

2. Change your code to reflect the virtual location created in step 1:
   frame1.Attributes("src") = "/data/Issues/Ext Nos.pdf"


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Bind Two Variables to LinkButton Control cyberstore05 .NET Framework 2.0 1 October 31st, 2008 02:50 AM
LinkButton PostBack handler in custom control Ozzy Bongo BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 July 24th, 2008 07:55 AM
WebControls.LinkButton Ric_H ASP.NET 2.0 Basics 1 January 28th, 2006 08:00 AM
linkbutton Beulah VS.NET 2002/2003 3 October 10th, 2005 05:00 PM
LinkButton List Control bmains ASP.NET 1.0 and 1.1 Professional 1 February 27th, 2004 09:05 PM

All times are GMT -4. The time now is 08:10 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.