• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 23
  • Last Modified:

ASP.NET public site connect to internal data source

I have a public facing ASP.NET web forms site. Client want to use an internal SQL Server to access data and in some cases also access data that is beyond their internal network. My question is how do I modify the connection string and connection to allow the SQL connection to connect and access data in their internal network from a ASP.NET web forms site not on their network?
Kelly Martens
Kelly Martens
1 Solution
Dirk StraussSenior Full Stack DeveloperCommented:
There wouldn't be too much difference between connecting to a local server (on the internal network) and connecting from an external ASP.NET site to a local SQL database. You would probably need to have the database administrator configure the server to allow remote connections, but in essence the connection string in your web.config file would point to an IP address and Port. It could look something similar to:

  <add name="MyConnectionString" connectionString="Data Source=SERVER-IP:PORT;Database=DBName;User Name=<user>;Password=<pass>" providerName="System.Data.SqlClient" />

Open in new window

This way you can connect to the remote server (it's remote to your ASP.NET application and access the required data.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now