We help IT Professionals succeed at work.

asp.Net HREF Link to a .pdf file outside wwwroot falls over - C not a registered profile

Gary Croxford
Medium Priority
Last Modified: 2012-05-11

I'm trying to build a document management/library system where users link to .pdf documents. The document name, reference and path to the selected document are stored in an Access database.

I originally set the document path to point to a directory c:\documentation but when I click on the hyperlink I gt the message "c is not a registered profile"

If I move the document to the same directory on the webserver as the aspx file the link works but this arrangement isn't practical.

How do I make a link to a location outside the webserver virtual directory?

The code is below:

<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script language="VB" runat="server" Debug="true">

      sub Page_Load(obj as Object, e as EventArgs)

            Dim strCriterion as String
            strCriterion = "WorkInst9001"

            'Set Up Connection
            dim objConn as new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Document\Documentation.mdb")

            'Open Connection
            dim objCmd as new OleDbDataAdapter ("SELECT txtDocumentReference, txtDocumentName, txtDocumentPath FROM tblDocumentation WHERE txtCatShortCut LIKE '" & strCriterion & "'", objConn)

            'Fill Dataset
            dim dsISOCategory as DataSet = new DataSet()
            objCmd.Fill(dsISOCategory, "tblDocumentation")

            'Select Data View and Bind to Server Control
            MyDataList.DataSource = dsISOCategory.Tables("tblDocumentation").DefaultView
      end sub

      <table valign="top" height="100%" cellspacing=0 cellpadding=0>
            <tr height="100%">
                  <td valign="top">
                        <ASP:DataList id="MyDataList" RepeatDirection="Vertical" runat="Server">
                                    <DIV style="padding:15,15,15,15;font-size:12pt;font-family:Arial">
                                                <a href=<%# DataBinder.Eval(Container.DataItem, "txtDocumentPath")%> target="_blank"><%# DataBinder.Eval(Container.DataItem, "txtDocumentName")%></a>
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
Gary CroxfordOperations Support Analyst


Thank you
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.