Connection Problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear All

I am having a problem trying to establish a connection with SQL Server using ASP.net page. I am using Server Explore
to establish a connection. The connection is perfectly established if I use Northwind or pubs Database. But I am unabl
to establish a connection if I make my own database.The error is

Server Error in '/Login' Application
-------------------------------------------------------------------------------

Cannot open database requested in login 'Database_Name'. Login fails. Login failed for user 'S-SABIR\ASPNET'.

This error never shows up.when a connection is established with Northwind and Pubs database

Please help me in this case
 
Hi Sunil,

Asp.net application runs under local aspnet account which can't connect to
remote sql server or even local by default.
(it works in design time because your windows account is used for
authentication to sql server).
You might change the account under which asp.net app runs:
just put a line into web.config file somewhere under
<system.web> node:
<identity impersonate="true" userName="USER" password="PASSWORD"/>

or provide a connection string with sql server authentication.

HTH
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Sunil Sabir said:
Dear All,

I am having a problem trying to establish a connection with SQL Server
using ASP.net page. I am using Server Explorer
to establish a connection. The connection is perfectly established if I
use Northwind or pubs Database. But I am unable
to establish a connection if I make my own database.The error is :

Server Error in '/Login' Application.
-------------------------------------------------------------------------- ------

Cannot open database requested in login 'Database_Name'. Login fails.
Login failed for user 'S-SABIR\ASPNET'.
 
Back
Top