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
on
Medium Priority
742 Views
Last Modified: 2012-05-11
Hello,

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
            MyDataList.DataBind()
      end sub
</script>

<html>
<body>
      <h2>ISO9001</h2>
      <table valign="top" height="100%" cellspacing=0 cellpadding=0>
            <tr height="100%">
                  <td valign="top">
                        &nbsp;
                        <ASP:DataList id="MyDataList" RepeatDirection="Vertical" runat="Server">
                              <ItemTemplate>
                                    <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>
                                    </DIV>
                              </ItemTemplate>
                        </ASP:DataList>
                  </td>
            </tr>
      </table>
</body>
</html>
Comment
Watch Question

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

Author

Commented:
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.

OR

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.