Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path
Config and connection string remote server path Config and connection string remote server path
Config and connection string remote server path
Go Back  Xtreme Visual Basic Talk > > > Config and connection string remote server path


Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2014, 12:51 PM
psy51 psy51 is offline
Newcomer
 
Join Date: Jan 2010
Posts: 1
Exclamation Config and connection string remote server path


I need help with my connection string for an Accessdb on a remote server.It worked fine on my local connection but I cannot get the correct code for the remote shared Server pathin my web.config file and/or aspx page. I understand that I cannot use Server.MapPath in the config file so I have used a 2 part code (Web.Config file and a script in the head section of my Webform1.aspx. Webform1 also uses "connectionstring1" with an SQL datasource. The database (NewBase2.accdb) is in an App_Data folder in the root directory. The web application and aspx pages including the WebForm1 are in a directory named "fsi" (Root/fsi/WebForm1)

My code WebForm1:
Code:
sub Page_Load
dim dbconn
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
data source=" & server.mappath(App_Data/"NewBase2.accdb"))
dbconn.Open()
end sub
Code in Web.Config:
Code:
<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>

  <connectionStrings>

 <add name="ConnectionString1" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\App_Data\NewBase2.accdb" providerName="System.Data.OleDb" />

  </connectionStrings>
  
</configuration>
I can open the default.aspx page without an error. When I try to open WebForm1.aspx which connects to the database I get errors.

For the above code the error message is 'c:\App_Data\NewBase2.accdb' is not a valid path'

If I remove the first backslash, writing Data Source=App_Data\NewBase2.accdb" the error message is: 'c:\windows\system32\inetsrv\App_Data\NewBase2.accdb is not a valid path.

I have tried several variations of the Data Source in the web.config file such as changing the web.config to" Data Source={0}", resulting in
error message 'c:\windows\system32\inetsrv\{0} is not a valid path.

I am assuming that the script for WebForm1 is accurate but perhaps it is in conflict with the config code?

Any ideas what I am coding incorrectly or any reason it will not work would be greatly appreciated.
Psy51

Last edited by Flyguy; 10-13-2014 at 01:36 AM. Reason: Added [code][/code] tags
Reply With Quote
  #2  
Old 11-25-2014, 10:36 AM
sanu sanu is offline
Newcomer
 
Join Date: Nov 2014
Posts: 2
Default

From my point of view, the syntax of your client side should be likeProvider=Microsoft.Jet.OLEDB.4.0;
Data Source=\\serverName\shareName\folder\myDatabase.mdb;
Reply With Quote
Reply

Tags
asp.net, connection string, remote server, web config


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path Config and connection string remote server path
Config and connection string remote server path
Config and connection string remote server path
 
Config and connection string remote server path
Config and connection string remote server path
 
-->