c# - Why iis host application do not let log in? -


I have organized my ability in IIS-7 and it browses appropriately, but it's time to log me in now For, desipte i checked that it has a correct connection string, it throws an error on my log page

Description: An uncontrolled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where the code has originated from it.

  Exception Description: System.NullReferenceException: Object references are not set for an instance of an object Source error: Line 96: SqlParameter [] arrParams = New SqlParameter [0]; Line 97: _userDetails = Data. Gate SQL QCreables (SQLF, 0, AirParamum); Line 98: If (_userDetails.Rows.Count! = 0) Line 99: {Line 100: _userAccountID = _userDetails.Rows [0] ["UserAccountID"]. ToString (); Source file: d: \ Projects \ June 20 \ CorrDefensev2 \ App_Code \ UserInfo.cs Row: 98 Stack Trace: [NullReferenceException: Object references are not set for an instance of an object.] UserInfo.setUserData (MembershipUser membershipUser) d In: Projects \ 20 Jun \ CorrDefensev2 \ App_Code \ UserInfo.cs: 98 UserInfo..ctor (string user name) in d: projects \ June 20 \ CorrDefensev2 \ App_Code \ UserInfo.cs: 76 Account_Login.Login1_LoggingIn (object sender , LoginCancelEventArgs e): Projects \ June 20 \ CorrDefensev2 \ MyPublic \ Login.aspx.cs: 76 System.Web.UI.WebControls.Login.OnLoggingIn (LoginCancelEventArgs E) 115 System.Web.UI .WebControls.Login.AttemptLogin () 85 System.Web.UI.WebControls.Login.OnBubbleEvent (Object Source, EventArgs E) 101 System.Web.UI.Control.RaiseBubbleEvent (Object Source, EventArgs args) +37 System.Web. UI.WebControls.ImageButton OnCommand (CommandEventArgs E) +125 System.Web.UI.WebControls.ImageButton.RaisePostBackEvent (string eventArgument) 177 System.Web.UI.WebControls.ImageButton.System.Web.UI.IPost BackEventHandler.RaisePostBackEvent (String Event Agreement) +10 System . Web. UI. Page Rise Postback Event (IoFackbackEventHandler Source Control, String Event Agreement) +13 SystemWee.U.Page. Rise Postback Event (NameWallClosurePoltData) +36System Web. UI page. ProcessRequestMain (Boolean includedStagesBeforeAsyncPoint, Boolean includedStagesAfterAsyncPoint) 5563 Solution: I used to have a connection string in web.config with all the SQL Server authentication user names, passwords, and it works great ...   

  SQLparamator [] arrParams = new SQLParamator [0]; _userDetails = Data. GETSQLQueryResults (sqlQuery, 0, arrParams);   

If you are passing with zero elements in arrParams, some parameters in your query can expect to return the results. There is a chance that you are empty for _user, as you are now getting. You can prevent exception by checking the tap on _userDetails

  if (_userDetails! = Null & amp; _userDetails.Rows.Count! = 0) {}  <  
  If (_userDetails! = Null) {// does not return any data table (_userDetails.Rows.Count! = 0) {/ / No records found}}    

Comments