As I did with ASP, I am using IIS to develop pages with asp.net. However, I cannot make relative addresses work. Here is my code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dim cn As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet .OLEDB.4.0;DataSource=~/committees.mdb;")
Dim cn As New Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet .OLEDB.4.0;DATA SOURCE=" & _
"D:\websites\pbocchurch\church\aspx\committees.mdb ;")
Dim da As New Data.OleDb.OleDbDataAdapter("select * from major", cn)
Dim dt As New Data.DataTable
da.Fill(dt)
da.Dispose()
cn.Dispose()
Me.GridView1.DataSource = dt
Me.GridView1.DataBind()
End Sub
And at the top of the page
<%@ Page Language="
VB" AutoEventWireup="false" CodeFile="connect2.aspx.
vb" Inherits="connect2" Debug="true"%>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data" %>
Now, if I use a relative address in the connection string, ie,
("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & _
"committees.mdb;")
I get the following error: "Could not find file 'C:\WINDOWS\system32\committees.mdb'."
The problem is when I upload the completed file, the full address will be incorrect. How can I make relative addresses work in IIS?