Wrox Programmer Forums
BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Special Edition by Bill Evjen, Scott Hanselman, Devin Rader, Farhan Muhammad, Srinivasa Sivakumar; ISBN: 9780470041789
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 24th, 2008, 11:48 AM
Registered User
Join Date: Nov 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Developing pages with IIS

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
        Me.GridView1.DataSource = dt
    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=" & _

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?

Old November 25th, 2008, 12:02 AM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

You need to do something like this:

"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & _
                       Server.MapPath("committees.mdb") & ";"


================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run asp pages in IIS femina ASP.NET 1.0 and 1.1 Basics 20 February 22nd, 2006 12:31 PM
Cannot view asp pages with Win XP Pro (IIS 5.1) amonte Classic ASP Basics 6 January 23rd, 2005 06:16 PM
Hosting ASP .NET pages outside IIS sureshsundar007 General .NET 6 June 9th, 2004 12:09 AM
IIS Problem with ASP Pages rodmcleay Classic ASP Basics 2 April 18th, 2004 08:47 PM
Problems displaying web pages using IIS kathryne Classic ASP Professional 1 November 14th, 2003 12:48 PM

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