Member_2_5230414
asked on
'C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofiles\forums\forum.mdb' is not a valid path.
I have just published my website and i get the error message
but i have not set my paths to 'C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofi les\'
does it add the paths when u publish it as my paths on server??
my webconfig file is:
and main.aspx is
Exception Details: System.Data.OleDb.OleDbException: 'C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofi les\forums \forum.mdb ' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
but i have not set my paths to 'C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofi
does it add the paths when u publish it as my paths on server??
my webconfig file is:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="forumConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="forum\forum.mdb""
providerName="System.Data.OleDb" />
</connectionStrings>
<system.web>
<compilation debug="false" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="home.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/"
name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
and main.aspx is
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="main.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/Site.css" rel="stylesheet" type="text/css" />
<link href="../Styles/Site.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="../Javascript/imagecycle.js"></script>
<script type="text/javascript" src="../Javascript/curvycorners.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="top-page-header"><div id="head-wrapper">
<div id="site-logo">
<asp:Image ID="Image1" runat="server"
ImageUrl="~/images/runningprofilestext.gif" />
<asp:Image ID="Image2" runat="server" ImageUrl="~/images/rplogo.gif" />
</div>
</div></div>
<div class ="largeMain">
<div id="maininfolarge">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
PagerSettings-Visible="false" AllowPaging="True"
CellPadding="4" DataKeyNames="ID" DataSourceID="AccessDataSource1"
ForeColor="#333333" GridLines="None" PageSize="5" Width="100%"
style="text-align: center; margin-bottom: 7.5px;margin-top: 7.5px;">
<AlternatingRowStyle BackColor="#f9f9f9" />
<Columns>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Image ID="newpost1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Forum">
<ItemTemplate>
<asp:Label ID="Forumname" runat="server" Text="Label" Font-Bold="True" Font-Size="Medium"></asp:Label><br />
<asp:Label ID="Forumdesciption" runat="server" Text="Label" Font-Italic="True"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Post">
<ItemTemplate>
<asp:Label ID="Lastpost" runat="server" Text="Label"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Topics">
<ItemTemplate>
<asp:Label ID="Postnumber" Font-Bold="True" runat="server" Text="Label"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Posts">
<ItemTemplate>
<asp:Label ID="Postnumber2" Font-Bold="True" runat="server" Text="Label"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#001C2A" ForeColor="White" Font-Bold="True" />
<HeaderStyle BackColor="#001C2A" Font-Bold="True" ForeColor="White" />
<PagerSettings Visible="False" />
<RowStyle ForeColor="" BackColor="#f9f9f9" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
</div>
</div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="forum.mdb"
SelectCommand="SELECT * FROM [forum] ORDER BY [Posttime] DESC">
</asp:AccessDataSource>
<div class="forumstats">
<div class="statsheader">
<u>Whats Going On?</u></div>
<div class="activeusers">
<b>Currently Active Users:</b> <asp:Label ID="Userson" Font-Bold="True" runat="server" Text="Label"></asp:Label></div>
<div class="activeusersnames"> <asp:Label ID="Usersnames" runat="server" Text="Label"></asp:Label></div>
<div class="activeusers"> <b>Forum Post & Member Stats</b> </div>
<div class="activeusersnames"> Threads: <b><asp:Label ID="threads" runat="server" Text="Label"></asp:Label></b>, Posts: <b><asp:Label ID="posts" runat="server" Text="Label"></asp:Label></b>, Members: <b><asp:Label ID="totalmembers" runat="server" Text="Label"></asp:Label>
</b></div>
<div class="activeusersnames"> Welcome to the newest member: <b><asp:Label ID="newguy" runat="server" Text="Label"></asp:Label> </b></div>
</div>
</form>
</body>
</html>
Have you tried placing the full physical server path to the access file in the connection string rather than a relative one?
Before using the connection string, you need to convert the relative path to physical path using the Server.MapPath function.
ASKER
i cant as i dont know where its adding the full path...is this normal?
This is where you can add it manually behind the data source option:
<add name="forumConnectionStrin g" connectionString="Provider =Microsoft .Jet.OLEDB .4.0;Data Source=D:\mywebsite\forum\ forum.mdb"
Alternatively, you can use the Server.MapPath function like CodeCruiser mentioned. Here is a forum discussing its use when dealing with an accessd database.
http://forums.asp.net/t/308568.aspx
<add name="forumConnectionStrin
Alternatively, you can use the Server.MapPath function like CodeCruiser mentioned. Here is a forum discussing its use when dealing with an accessd database.
http://forums.asp.net/t/308568.aspx
ASKER
Hey code cruser... how do i user the Server.MapPath function ??
Well you can construct the connection string dynamically
Dim conStr as String = "Provider=... Data Source = " & Server.MapPath("forum/foru m.mdb")
Dim conStr as String = "Provider=... Data Source = " & Server.MapPath("forum/foru
Maybe use "|DataDirectory|" token:
http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/dc31ea59-5718-49b6-9f1f-7039da425296/
http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/dc31ea59-5718-49b6-9f1f-7039da425296/
ASKER
i have done the above and i still get 'C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofi les\forums \forum.mdb '
how can i find where this is!
how can i find where this is!
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.