?
Solved

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

Posted on 2011-04-21
2
Medium Priority
?
692 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>
0
Comment
Question by:Crxfrd
2 Comments
 
LVL 8

Accepted Solution

by:
edemcs earned 2000 total points
ID: 35441093
Open IIS and right-click on the website.  Add Virtual Directory and select your path.  That's it.
0
 

Author Closing Comment

by:Crxfrd
ID: 35441188
Thank you
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question