error when connecting to database question in asp.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dk

    error when connecting to database question in asp.net

    this is the DSN connection string in web.confi

    <add key="DSN" value="server=l ocalhost;databa se=userDB;Integ rated Security=SSPI" /

    any idea regarding what is causing this following error message when the connection object trys to open
    tia
    d

    Server Error in '/FormsAuth' Application
    -------------------------------------------------------------------------------

    Login failed for user 'CHODRON\ASPNET '.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.Sql Client.SqlExcep tion: Login failed for user 'CHODRON\ASPNET '

    Source Error:

    Line 95: strCn=System.Co nfiguration.Con figurationSetti ngs.AppSettings["DSN"].ToString()
    Line 96: SqlConnection cn=new SqlConnection(s trCn)
    Line 97: cn.Open()
    Line 98: tr
    Line 99:


    Source File: c:\inetpub\wwwr oot\formsauth\u serdb.cs Line: 97

    Stack Trace:

    [SqlException: Login failed for user 'CHODRON\ASPNET '.
    System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean& isInTransaction
    System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString options, Boolean& isInTransaction
    System.Data.Sql Client.SqlConne ction.Open(
    FormsAuth.UserD B.SaveNewUser(S tring UserName, String LastName, String FirstName, String email, String PasswordHash, String Salt, Boolean MustChangePassw ord) in c:\inetpub\wwwr oot\formsauth\u serdb.cs:9
    FormsAuth.User. SaveNewUser(Str ing UserName, String LastName, String FirstName, String email, String Password, Boolean MustChangePassw ord) in c:\inetpub\wwwr oot\formsauth\u ser.cs:16
    FormsAuth.Regis ter.Button1_Cli ck(Object sender, EventArgs e) in c:\inetpub\wwwr oot\formsauth\r egister.aspx.cs :7
    System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +10
    System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +5
    System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +1
    System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +3
    System.Web.UI.P age.ProcessRequ estMain() +127



  • CMA

    #2
    Re: error when connecting to database question in asp.net

    try using this connection string .....

    <add key="DSN" value="server=l ocalhost;databa se=userDB;uid=d atabase user
    name;pwd=databa se user password;Connec tion Lifetime=0"/>

    if u need to hide the password, u have to use encrypted way to do it..

    hope this helps,
    CMA


    "dk" <anonymous@disc ussions.microso ft.com> wrote in message
    news:C001D5C9-4477-4AC3-AA6A-9CF4A7AEB026@mi crosoft.com...[color=blue]
    > this is the DSN connection string in web.config
    >
    > <add key="DSN" value="server=l ocalhost;databa se=userDB;Integ rated[/color]
    Security=SSPI" />[color=blue]
    >
    > any idea regarding what is causing this following error message when the[/color]
    connection object trys to open?[color=blue]
    > tia,
    > dk
    >
    >
    > Server Error in '/FormsAuth' Application.
    > --------------------------------------------------------------------------[/color]
    ------[color=blue]
    >
    > Login failed for user 'CHODRON\ASPNET '.
    > Description: An unhandled exception occurred during the execution of the[/color]
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.[color=blue]
    >
    > Exception Details: System.Data.Sql Client.SqlExcep tion: Login failed for[/color]
    user 'CHODRON\ASPNET '.[color=blue]
    >
    > Source Error:
    >
    >
    > Line 95:[/color]
    strCn=System.Co nfiguration.Con figurationSetti ngs.AppSettings["DSN"].ToString
    ();[color=blue]
    > Line 96: SqlConnection cn=new SqlConnection(s trCn);
    > Line 97: cn.Open();
    > Line 98: try
    > Line 99: {
    >
    >
    > Source File: c:\inetpub\wwwr oot\formsauth\u serdb.cs Line: 97
    >
    > Stack Trace:
    >
    >
    > [SqlException: Login failed for user 'CHODRON\ASPNET '.]
    > System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&[/color]
    isInTransaction )[color=blue]
    >[/color]
    System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne c
    tionString options, Boolean& isInTransaction )[color=blue]
    > System.Data.Sql Client.SqlConne ction.Open()
    > FormsAuth.UserD B.SaveNewUser(S tring UserName, String LastName, String[/color]
    FirstName, String email, String PasswordHash, String Salt, Boolean
    MustChangePassw ord) in c:\inetpub\wwwr oot\formsauth\u serdb.cs:97[color=blue]
    > FormsAuth.User. SaveNewUser(Str ing UserName, String LastName, String[/color]
    FirstName, String email, String Password, Boolean MustChangePassw ord) in
    c:\inetpub\wwwr oot\formsauth\u ser.cs:168[color=blue]
    > FormsAuth.Regis ter.Button1_Cli ck(Object sender, EventArgs e) in[/color]
    c:\inetpub\wwwr oot\formsauth\r egister.aspx.cs :72[color=blue]
    > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
    >[/color]
    System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP o
    stBackEvent(Str ing eventArgument) +57[color=blue]
    > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler[/color]
    sourceControl, String eventArgument) +18[color=blue]
    > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
    > System.Web.UI.P age.ProcessRequ estMain() +1277
    >
    >
    >[/color]


    Comment

    Working...