All Questions
Tagged with connection-string asp.net
666
questions
273
votes
13
answers
462k
views
Read connection string from web.config
How can I read a connection string from a web.config file into a public class contained within a class library?
I've tried:
WebConfigurationManager
ConfigurationManager
But these classes are not ...
101
votes
15
answers
733k
views
Setting up connection string in ASP.NET to SQL SERVER
I'm trying to set up a connecting string in my web.config file (Visual Studio 2008/ASP.NET 3.5) to a local server (SQL server 2008).
In my web.config, how and where do I place the connection string?
...
101
votes
3
answers
132k
views
Escape quote in web.config connection string
I have a connection string in my web config:
<add name="MyConString" connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" providerName="System.Data.SqlClient" />
As you see, ...
65
votes
18
answers
471k
views
How to fix "The ConnectionString property has not been initialized"
When I start my application I get: The ConnectionString property has not been initialized.
Web.config:
<connectionStrings>
<add name="MyDB"
connectionString="Data ...
55
votes
2
answers
114k
views
SQL providerName in web.config
We are using ASP.NET (Framework 2) and setting database connection strings (SQL2005) in web.config.
We are currently using "providerName=SqlServer".
All our data accesses are done using System.Data....
54
votes
1
answer
260k
views
A network-related or instance-specific error occurred while establishing a connection to SQL Server [closed]
I deployed my asp.net web application on somee.com, whenever I login into this site (ipc.somee.com) it gives me a network related error like:
A network-related or instance-specific error occurred ...
37
votes
9
answers
140k
views
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'
I been strugling with this for 2 days now without comming any closer to solution. I have read 20-30 threads alteast and stil can not resolve this.
Please help me out.
I have disable anonymous ...
34
votes
9
answers
63k
views
Keyword not supported: 'server'
I've been trying to edit my connection string for uploading my website to a server.
I am not really experienced with this. I got this exception: the Keyword not supported: 'server'.
Here is my ...
33
votes
6
answers
44k
views
No context type was found in the assembly
I'm using .NET 4.0, MVC3, and EF5 with code first.
My solution is split up into three projects, with the dependencies as indicated:
Project.Web -> Project.BLL -> Project.DAL
The Project.DAL layer ...
30
votes
5
answers
105k
views
Get Connection String from Web.config in asp.net
I want to know the ways to get connection string from web.config file in asp.net.
I just only know the below way .
using System;
using System.Collections.Generic;
using System.Linq;
using System....
28
votes
13
answers
16k
views
Connection string hell in .NET / LINQ-SQL / ASP.NET
I have a web application that comprises the following:
A web project (with a web.config file containing a connection string - but no data access code in the web project)
A data access project that ...
26
votes
7
answers
147k
views
Connection string - Keyword not supported: 'initial catalog'
I am using Webmatrix.data's Database entity to create a database connection, however it doesnt like my connection string. I am running it from MVC ASP.net.
Ive tried changing it to server / database,...
25
votes
8
answers
19k
views
Can I Add ConnectionStrings to the ConnectionStringCollection at Runtime?
Is there a way where I can add a connection string to the ConnectionStringCollection returned by the ConfigurationManager at runtime in an Asp.Net application?
I have tried the following but am told ...
23
votes
4
answers
60k
views
What is the maximum and minimum size of connection pool ADO.Net Supports in the connection string?
What is the maximum and minimum size of connection pool ADO.Net Supports in the connection string.Min Pool Size=[max size ?]Max Pool Size=[min size]
23
votes
4
answers
8k
views
web.config transform - delete comments from connectionstring section
I store several different connection strings in my web.config for development and testing. All but one is commented out so I can change info as needed.
When I publish, I would like to replace ...
21
votes
1
answer
35k
views
The entry has already been added
All my Razors views have this error:
The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message:
The ...
21
votes
20
answers
151k
views
How to fix error ::Format of the initialization string does not conform to specification starting at index 0::
I uploaded my site on godaddy shared host. I can access this database from my management studio. I can't access this database from my site. I get following error:
Format of the initialization ...
19
votes
4
answers
15k
views
User Secrets in .NET 4.7 connectionstrings format
I have been digging for hours and keep coming up with information about .NET Core, yet hardly anything about .NET 4.7 full framework. I figured out how to add User Secrets to the main project of my ...
18
votes
4
answers
202k
views
error: the details of the application error from being viewed remotely
I have 2 login pages: Login.aspx-for customer login and xlogin.aspx for admin login
i just uploaded my project to the server and all application pages works great
but when i log in the admin xlogin....
16
votes
5
answers
13k
views
Is there a need to secure connection string in web.config?
So I am using connection strings in my web.config using SQL authentication.
Of course people say this could be a vulnerability as you are storing password in plaintext.
However, from what I know, ...
16
votes
1
answer
10k
views
ELMAH Logging in SQL Server
I am having an ELMAH problem. I think it is the connection string but can't figure out why. It is emailing me errors no problem, just not logging them into sql. If the problem is permissions, how ...
16
votes
4
answers
11k
views
Connection String Best Practices [closed]
What is the best way to manage connection strings in a web application, from a security standpoint? I've done it several different ways. I've stored them as plain text web.config setting keys. I've ...
15
votes
1
answer
13k
views
What's the Option=N in the MySQL ODBC connection string?
I have seen both Option=3 and Option=4 in connection string samples for MySQL ODBC but no explanation or documentation. What do those numbers mean?
15
votes
3
answers
26k
views
ASP.NET connection string metadata syntax
I'm new to ASP.NET-ville, be gentle.
I have been troubleshooting a ASP.NET setup, where the server/database values are changing, therefore web.config needs to be updated.
There are multiple <add ...
15
votes
3
answers
15k
views
the best way to connect sql server (Windows authentication vs SQL Server authentication) for asp.net app
I have a database and a site having forms authentication. It is working fine with VS2008. This time, I am using "Trusted_connection =True". But when it is opened from outside or directly from browser ...
14
votes
2
answers
77k
views
Oracle connection string without tnsnames.ora file
I am using the .NET framework with the System.Data.OracleClient namespace. I have the oracle 11 client installed on my computer. I do not want to use the tnsnames.ora file to store connection ...
14
votes
9
answers
22k
views
Managing A Debug and Release Connection String
What is a good approach to managing a debug and release connection string in a .NET / SQLServer application?
I have two SQL Servers, a production and a build/debug and I need a method of switching ...
14
votes
4
answers
2k
views
How is everyone storing connectionstrings?
I was wondering if people could post their solution to the ongoing problem of local databases and different connectionstrings among many developers in one project within source control?
More ...
13
votes
4
answers
21k
views
Linq to Sql - Set connection string dynamically based on environment variable
I need to set my connection string for Linq to Sql based on an environment variable. I have a function which will return the connection string from the web.config based on the environment variable, ...
13
votes
5
answers
128k
views
How to increase time in web.config for executing sql query
When I am running a query in web application, I'm getting a null value. Same query directly in SQL Management Studio returns results.
I think that the problem is a timeout. How can I increase the ...
12
votes
5
answers
19k
views
Using Hangfire, connection string given in Startup.cs throws Cannot attach file as database error
I'm utilizing Hangfire in my ASP .Net MVC Web App, it had installed successfully. I'd like to use the same LocalDb to store queued jobs for Hangfire to dequeue and process as I've used to stored data. ...
12
votes
4
answers
44k
views
Getting sql connection string from web.config file
I am learning to write into a database from a textbox with the click of a button. I have specified the connection string to my NorthWind database in my web.config file. However I am not able to access ...
11
votes
2
answers
20k
views
how to change connection string initial catalog
I have a connection string in web config file.
I used this connection with name in all my files.
connection string is like
<add name="connectionname" connectionString="Data Source=DEVELOPER1;...
11
votes
9
answers
33k
views
asp.net mvc Invalid value for key 'attachdbfilename'
I am currently reading Manning's "ASP.NET MVC 4 in Action" book and trying to get the first example to work.
Within my test application, I built a simple Model and created some Views. I then ...
10
votes
7
answers
31k
views
How Can We Have two Connection Strings In Web.Config And Switch Betweeen Them In Code Behind?
When I add two connection strings in the web.config, an error appears that tells me I can't add two connection strings in the web.config.
I want the upper job because I have 2 databases and I want ...
10
votes
4
answers
15k
views
How can I set read-only DB Connection Strings?
I've got a DB connection string that I'm creating in my web.config:
<connectionStrings>
<add name="DBConn" connectionString="Data Source=<db svr>;Initial Catalog=<...
10
votes
3
answers
18k
views
Difference between these connection strings?
Can anybody tell me the effective difference between the following connection strings:
<add key="ConnectionString" value="server=tcp:192.168.0.12\Sqlserver2005;database=;user id=sa;password=;">
...
10
votes
4
answers
26k
views
DSN to connectionstring?
We've got an ASP.NET website that uses a database that we want to be able to use a connectionstring to get to. We've successfully set up a DSN for connecting to this DB, but I can't seem to discover ...
10
votes
2
answers
49k
views
Calling a stored procedure with asp.net
If I have a connection string defined in my web.config file, how do I create a connection to the SQL db from C# code (sorry forgot to specify) and then call a stored procedure. I would then like to ...
9
votes
7
answers
13k
views
Storing connection strings in machine.config vs storing them in web.config
For a dedicated server, is it better to store the connection string in web.config or machine.config? what's the advantages and disadvantages of each approach?
Thanks
Edit: I'm concerned about ...
9
votes
6
answers
25k
views
'MultipleActiveResultsSets' Keyword Not Supported
I am trying to read from an SQL Server database which is hosted on MS Azure, through an ASP.NET WebForms website created in Visual Studio 2013.
I've stored the Connection String in Web.Config, and ...
8
votes
3
answers
35k
views
Creating a string in a web.config and use it in a web.api
I am new in the web development world and I would like to create a variable in the web.config file so that I can use it in the .NET portion of the web.api
I found the following tutorials on how to do ...
8
votes
3
answers
4k
views
.NET 4: How to configure EDMX file in other assembly in Web.Config
I have a problem with configuring an EDMX file that lives in an other assembly than by web project. My project looks somewhat like this:
Project 1
--> Database.edmx
--> App.Config
Project 2
--&...
7
votes
2
answers
11k
views
MembershipProvider change connection string in code
I am trying to implement Asp.net Forms Authentication in my site. Usually, you provide the name of your DB connection string in your web.config. However, as our database setup is a little more ...
7
votes
2
answers
16k
views
"Data source name not found and no default driver specified" error
I'm getting an error like ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified when publish the website. If I'm running the website from ...
7
votes
2
answers
2k
views
Can I reuse an Existing Connection String in my SQL Session State Config?
I'm using SQL Session State in my app, however given that we have several connection strings already, it would be easier to maintain the config if all the connection strings were held, well, in <...
7
votes
1
answer
9k
views
Keyword not supported: 'data source' in ASP.net Entity Framework 6
I've been poking my brain around for a few days trying to figure this out.
I'm using winhost to host a SQL Server and I've looked up quite a few similar questions with the same issue but they all ...
7
votes
3
answers
31k
views
ASP.NET System.Data.EntityClient connection string help
I'm running ASP.NET MVC on a shared server and I'm having problems connecting to SQL via System.Data.EntityClient. Below is the connection string that my hosing provider gave me to connect to SQL and ...
7
votes
2
answers
6k
views
ASP.NET connection string to local SQL Server database, using web.config
Why is System.Data.SqlClient.SqlConnection class throwing an exception that "The parameter is incorrect"?
I'm attempting to learn how to set up database connections using a local SQL database and an ...
7
votes
1
answer
17k
views
Get connection string in class library project in a solution
In my .net 4 solution, i have two different projects- an web application project and a class library project.
In web application project, database connection string is in web.config file. I would ...