Showing posts with label aspnet. Show all posts
Showing posts with label aspnet. Show all posts

Sunday, March 11, 2012

connection with sql server through asp.net

hi every body,

i find problems in connection string to connect with sql server through asp.net. the error is unknown connection option in connection string.

the connection string i have used is:

dim cnn as sqlconnection = new sqlconnection()

sqlcnn.ConnectionString = "datasource=arun;initialcatalog = reporting system;"

here arun is server name;reporting system is database

anyone help me

I think it's "initial catalog" instead of "initialcatalog". Take a look at following link for various connection string related info.

http://www.connectionstrings.com/

|||

hi,

take u for ur help. now i got the solution

Thursday, March 8, 2012

connection to SQL from asp.net page

I am using an asp.net page with vb.net. The following connection in my web.config file will connect the database to my page no problem:

"Data Source=MIAPPS1;Initial Catalog=MASTER_DB;Integrated Security=SSPI;"

However, when I add data to the page and try to preview it in the browser I get the following error:

"System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."

I'm kind of perplexed as to why I can attach a database to my page, test the connection view data -but not be able to connect when previewing through the browser.

Any Ideas?

BillHave you added the ASP.NET account to the server server authorized logins?|||I have added an account ASPNET. Is it ASPNET or ASP.NET. The error message also showed, null for the login, does this still point to the ASPNET login issue?|||Yes. The errors means that you either trying to connected to SQL with SQL Authication while only Windows Authentication is enabled, or that the windows account you're using is not one enlisted into the sql logins account.

If you're using IIS5 the account is ASP.NET, if using IIS6 is the Network Service account

Friday, February 24, 2012

Connection String in ASP.NEt

Hi

I'm using VB.NET in ASP.NET .

Windows 2000

Visual Studio 2005

and SQLServer 2005.

I'm new to VS 2005

I'm using the following code for connection

<

addkey="dsnstring"value="persist Security info=False; User ID=; password=;Initial Catalog=TransMate1; Data Source=Localhost trusted_connection=yes" />

it is giving the error as 'Cann't do the connection since user id cann't be null

It is not exact words of the error message.

following code is working fine with the SQL Server 2003 but not with SQL Server 2005.

<add key="dsnstring" value="persist Security info=False; User ID=sa; password=dreams;Initial Catalog=TransMate; Data Source=Localhost" />

Kindly help me

Thanks in advance

Regards.

If you use Trusted_Connection=yes that is, Windows Authentication, do not have userid or password in the connection string since they are dealed by the Windows authentication. You don't provide them in that case.

<add key="dsnstring" value="Initial Catalog=TransMate1; Data Source=Localhost;trusted_connection=yes" />

Connection string for the Ms-SQl Server using ASP.net

Hello,

I am doing the web based project for the final year of my couse
in Information Technology using Asp.net and ms-sql server.But to start
with that I need to connect my web pages to the database.
So Can anyone tell me how to connect my page web to the ms-sql
server using Asp.net(Connection String)?.It will be better if someone
give me the code for the connection string along with the explaination
so that I don't have problem understanding it.

Any kind of help will be appreciated.

Thank You.

Suchen Chodankar.Hi
Check out

http://msdn.microsoft.com/library/d.../SecNetHT03.asp
http://msdn.microsoft.com/library/d.../SecNetch12.asp
http://msdn.microsoft.com/library/d...ml/secmod83.asp
http://www.connectionstrings.com/

John

"Suchen Chodankar" <suchen.chodankar@.gmail.com> wrote in message
news:295fd3c8.0503112318.57e54ca3@.posting.google.c om...
> Hello,
> I am doing the web based project for the final year of my couse
> in Information Technology using Asp.net and ms-sql server.But to start
> with that I need to connect my web pages to the database.
> So Can anyone tell me how to connect my page web to the ms-sql
> server using Asp.net(Connection String)?.It will be better if someone
> give me the code for the connection string along with the explaination
> so that I don't have problem understanding it.
> Any kind of help will be appreciated.
> Thank You.
> Suchen Chodankar.

Tuesday, February 14, 2012

connection sql server with asp.net

hello all....i'm got a little problem here...i hope youu
guys can help me...
ok...first, i'm using asp.net for my web application. when
i run it in my own server, it's ok...got nothing problem
with connection to my database(in the same server)
but...when i'm bring it to my web server with a same
application and a same database, it has a problem...i've
got an error:
Login failed for user '(null)'. Reason: Not associated
with a trusted SQL Server connection
aspx page working properly...but i think it's problem with
my connection to database..i declare my connection stringg
at global.asax.vb like this:
Public Const dbstring As String = "integrated security =
sspi; initial catalog = sola; data source = server10"
can you guys help me......
Zalizan,
are you impersonating the user, and / or using anonymous access?
If you are using impersonation and anonymous, then the IIS anonymous user
from the new box will need adding as a login to SQL Server.
If you aren't using impersonation and have anonymous, then the
IISComputer/ASPNET login will need adding.
Alternatively you could use SQL Server logins, especially if you are on
different domains.
HTH,
Paul Ibison
|||for your information sir, i'm new with Sql Server, and i
think i have added IIS anonymous user at SQL in Web
server. so can you give me a better way to add login to
user. And how i want to know that if i use anonymous
access or not

>--Original Message--
>Zalizan,
>are you impersonating the user, and / or using anonymous
access?
>If you are using impersonation and anonymous, then the
IIS anonymous user
>from the new box will need adding as a login to SQL
Server.
>If you aren't using impersonation and have anonymous,
then the
>IISComputer/ASPNET login will need adding.
>Alternatively you could use SQL Server logins, especially
if you are on
>different domains.
>HTH,
>Paul Ibison
>
>.
>
|||Zalizan,
if you open Administrative Tools, Internet Service Manager, open up your
website, right-click and go to properties. On directory security, click
edit, and the top check box will show if you have enabled anonymous. It is
enabled by default. As far as asp.net is concerned, unless you are using
impersonation (not on by default) you will be using a windows user called
ASPNET if your connectionstring selects trusted security. The "ASPNET" user
account is created in Windows by Microsoft .NET Framework. It is an
automatic machine account created to limit access rights of .NET
applications. In your case I believe this account should be added as a login
to SQL Server.
To be sure of using the correct connection string syntax, you could create a
UDL file. To get the udl file to open, create a blank textfile named as
xxx.udl. Then double click it to go through the wizard. Inside the udl file
(if you open using notepad) will be the connection string in the correct
format. The connection object is set using this string as follows:
SQL:
cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=name;Password=password;Initial Catalog=database;Data Source=servername"
Trusted:
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;
Initial Catalog=database;Data Source=servername"
hope this helps,
Paul Ibison

connection sql server with asp.net

hello all....i'm got a little problem here...i hope youu
guys can help me...
ok...first, i'm using asp.net for my web application. when
i run it in my own server, it's ok...got nothing problem
with connection to my database(in the same server)
but...when i'm bring it to my web server with a same
application and a same database, it has a problem...i've
got an error:
Login failed for user '(null)'. Reason: Not associated
with a trusted SQL Server connection
aspx page working properly...but i think it's problem with
my connection to database..i declare my connection stringg
at global.asax.vb like this:
Public Const dbstring As String = "integrated security =
sspi; initial catalog = sola; data source = server10"
can you guys help me......Zalizan,
are you impersonating the user, and / or using anonymous access?
If you are using impersonation and anonymous, then the IIS anonymous user
from the new box will need adding as a login to SQL Server.
If you aren't using impersonation and have anonymous, then the
IISComputer/ASPNET login will need adding.
Alternatively you could use SQL Server logins, especially if you are on
different domains.
HTH,
Paul Ibison|||for your information sir, i'm new with Sql Server, and i
think i have added IIS anonymous user at SQL in Web
server. so can you give me a better way to add login to
user. And how i want to know that if i use anonymous
access or not

>--Original Message--
>Zalizan,
>are you impersonating the user, and / or using anonymous
access?
>If you are using impersonation and anonymous, then the
IIS anonymous user
>from the new box will need adding as a login to SQL
Server.
>If you aren't using impersonation and have anonymous,
then the
>IISComputer/ASPNET login will need adding.
>Alternatively you could use SQL Server logins, especially
if you are on
>different domains.
>HTH,
>Paul Ibison
>
>.
>|||Zalizan,
if you open Administrative Tools, Internet Service Manager, open up your
website, right-click and go to properties. On directory security, click
edit, and the top check box will show if you have enabled anonymous. It is
enabled by default. As far as asp.net is concerned, unless you are using
impersonation (not on by default) you will be using a windows user called
ASPNET if your connectionstring selects trusted security. The "ASPNET" user
account is created in Windows by Microsoft .NET Framework. It is an
automatic machine account created to limit access rights of .NET
applications. In your case I believe this account should be added as a login
to SQL Server.
To be sure of using the correct connection string syntax, you could create a
UDL file. To get the udl file to open, create a blank textfile named as
xxx.udl. Then double click it to go through the wizard. Inside the udl file
(if you open using notepad) will be the connection string in the correct
format. The connection object is set using this string as follows:
SQL:
cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=name;Password=password;Initial Catalog=database;Data Source=servername"
Trusted:
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;
Initial Catalog=database;Data Source=servername"
hope this helps,
Paul Ibison

Sunday, February 12, 2012

Connection Problems - works in WinForms, not in ASP.NET

Hi,

I am trying to connect to a remote SQL Server 2000 database using ASP.NET. This is my connection string

"Server=LOL-DEV;Database=Livelink;User ID=sa;Password=xxx;Trusted_Connection=False"

With this I get 'access denied or sql server doesn't exist'. If I use exactly the same code in a WinForms app, the connection works OK.

Does anyone have any idea why this might be?

Cheers

JamesI figured it out. You need to have

<identity impersonate="true" /
in your web.config

Connection problem: ASP.NET on machine and SQL Server on another

If anyone knows the answer to this Id me greatly appreciative.
I am not on a domain.
I have SQL Server sitting on computer A
Computer A has:
Windows XP SP2
SQL Server 2000 SP3a
SQL Server is set to use Trusted or SQL authorization
I have added a user X to SQL Server with a password of X
I am writing an ASP.NET app on Computer B. IIS and Dev on B)
I am trying to make a connection to SQL on computer A but get the
error SQL Server does not exist or access denied
Now when I create a small Winforms app as a test, I can use the exact
same connection string and open a connection to SQL Server just fine.
So, Im guessing the problems lies in the security of ASP.NET, but Im
not sure what to change to make this work.
Anyone with any ideas?
TIA
B
I should also point out, I can also connect just fine withn the same
user/pw with Enterprise Mager, and Query Analyzer as well as add the
connection to Visual Studio.
B
Brian W wrote:

> If anyone knows the answer to this Id me greatly appreciative.
> I am not on a domain.
> I have SQL Server sitting on computer A
> Computer A has:
> Windows XP SP2
> SQL Server 2000 SP3a
> SQL Server is set to use Trusted or SQL authorization
> I have added a user X to SQL Server with a password of X
> I am writing an ASP.NET app on Computer B. IIS and Dev on B)
> I am trying to make a connection to SQL on computer A but get the
> error SQL Server does not exist or access denied
> Now when I create a small Winforms app as a test, I can use the exact
> same connection string and open a connection to SQL Server just fine.
> So, Im guessing the problems lies in the security of ASP.NET, but Im
> not sure what to change to make this work.
> Anyone with any ideas?
> TIA
> B

Connection problem: ASP.NET on machine and SQL Server on another

If anyone knows the answer to this Id me greatly appreciative.
I am not on a domain.
I have SQL Server sitting on computer A
Computer A has:
Windows XP SP2
SQL Server 2000 SP3a
SQL Server is set to use Trusted or SQL authorization
I have added a user X to SQL Server with a password of X
I am writing an ASP.NET app on Computer B. IIS and Dev on B)
I am trying to make a connection to SQL on computer A but get the
error SQL Server does not exist or access denied
Now when I create a small Winforms app as a test, I can use the exact
same connection string and open a connection to SQL Server just fine.
So, Im guessing the problems lies in the security of ASP.NET, but Im
not sure what to change to make this work.
Anyone with any ideas?
TIA
BI should also point out, I can also connect just fine withn the same
user/pw with Enterprise Mager, and Query Analyzer as well as add the
connection to Visual Studio.
B
Brian W wrote:

> If anyone knows the answer to this Id me greatly appreciative.
> I am not on a domain.
> I have SQL Server sitting on computer A
> Computer A has:
> Windows XP SP2
> SQL Server 2000 SP3a
> SQL Server is set to use Trusted or SQL authorization
> I have added a user X to SQL Server with a password of X
> I am writing an ASP.NET app on Computer B. IIS and Dev on B)
> I am trying to make a connection to SQL on computer A but get the
> error SQL Server does not exist or access denied
> Now when I create a small Winforms app as a test, I can use the exact
> same connection string and open a connection to SQL Server just fine.
> So, Im guessing the problems lies in the security of ASP.NET, but Im
> not sure what to change to make this work.
> Anyone with any ideas?
> TIA
> B