1

I have hosted a web application(Application is in Asp.Net with C# language and Sql server database). Now i want to store data in my local database from my hosted web application.How will be the database connection string...any addition changes in Sql Server..?Please explain..Any reply will be appreciated..

DeEP

1
  • 1
    where are you hosting the application? In a public hosting services or in your machine or server? Commented Oct 12, 2011 at 8:21

2 Answers 2

1

from .NET 2 upwards the connection string can be stored in a specific node of the web.config file and not in appSettings as it was done before.

I am not sure about your question because if you try to access a database server located outside the network where you have deployed your ASP.NET application (so the hosting provider's internal network), it won't probably work, even in case your SQL Server is publicly available and open for connections from outside (which is bad, really, really bad...), it would also depend on the hosting company network settings.

How did you connect to the SQL Server during development and for debugging within the development machine?

There are info on how to connect to a SQL Server with a connection string in the web.config here: Using connection strings from web.config in ASP.NET v2.0 but not sure this solves your issue.

Sign up to request clarification or add additional context in comments.

5 Comments

ok...let me explain my question...i have a web application and its database..both are in my local pc...now i want to host the application
and what's the problem? is it already working fine on your local pc? so you must have the connection string working fine. you should verify with your public hosting provider how do they give you connectivity to their SQL Server, sometimes they give you ip address, other times server name etc...
@Nick show your current connection string in development, in general should be enough to replace the SQL server name with the IP Address, try this out locally and tell how it works...
<connectionStrings> <add name="dbcon" connectionString="Data Source=WEP;Initial Catalog=Kot;User ID=sa;password=safy"/> </connectionStrings>
Well, there's a problem: you should never be using sa for a database connection. Your hosting service probably won't be giving you sa...also, I hope that's a fake password at least.
0

Sounds like you need to speak to your network administrator - I'd guess that your firewall will probably be set up stop any attempt to access it from outside of your network.

If your hosting company allow it, you maybe able to set up a VPN between the web server and your local database but this would be a lot of hassle.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.