Solved

I created website and it is working fine while i running from visual studio but when i published in IIS, it shows error like below.  Could you pls help me to resolve this issue?

Posted on 2014-12-27
11
180 Views
Last Modified: 2015-01-09
Hi,

I created website and it is working fine while i running from visual studio but when i published in IIS, it shows error like below.

Could you pls help me to resolve this issue? String and error is like below.

Public Shared connstr As String = "Server=sgbdun302\mssqlserver12;UserID=corp\PA430002;Password=base4ball3;Database=FFKMaster;Trusted_Connection=True;Integrated Security=SSPI;Provider=SQLOLEDB.1"

Server Error in '/' Application.
________________________________________
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
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.OleDb.OleDbException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Source Error:
 
Line 31:         dbconn = New OleDbConnection(globalvariables.connstr)
Line 32:         sqljunk = "SELECT * FROM tblcflusers"
Line 33:         dbconn.Open()
Line 34:         dbcomm = New OleDbCommand(sqljunk, dbconn)
Line 35:         dbread = dbcomm.ExecuteReader

Source File: E:\Inetpub\wwwroot\ProdCust\WebSite6\login.aspx.vb    Line: 33

Stack Trace:
 
[OleDbException (0x80004005): Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.]
   System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +351
   System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
   System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +31
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +76
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
   System.Data.OleDb.OleDbConnection.Open() +43
   login.loginvalidation(String UserName, String Password) in E:\Inetpub\wwwroot\ProdCust\WebSite6\login.aspx.vb:33
   login.Login1_Authenticate1(Object sender, AuthenticateEventArgs e) in E:\Inetpub\wwwroot\ProdCust\WebSite6\login.aspx.vb:83
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +115
   System.Web.UI.WebControls.Login.AttemptLogin() +127
   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.Button.OnCommand(CommandEventArgs e) +125
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
 
________________________________________
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1022
0
Comment
Question by:ka8799
  • 5
  • 5
11 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40519512
Firstly,  Trusted_Connection=True  AND  Integrated Security=SSPI are exactly the same thing. They are just different ways of typing the same command in effect.

Secondly, You try and specify a username and password, if you are using Trusted_Connection=True then those will be ignored completely.

To use trusted mode your web server AND SQL server MUST be on the same AD domain.
Otherwise you need to use SQL authentication.
0
 
LVL 16

Expert Comment

by:Emmanuel Adebayo
ID: 40519517
Can you check the connectivity to your ODBC connectivity to your Database from your IIS server?

Also, is your SQL server in the same domain as your IIS server?

As Neilsr suggested, you might need to use SQL authentication if your server and IIS are not in the same domain instead of intregrated authentication.


Regards
0
 

Author Comment

by:ka8799
ID: 40521507
Hi,

I tried with SQL authentication with the below string. But still the same issue exists. Could you please here to move further?
Is that connection string correct?

Public Shared connstr As String = "Server=sgbdun302\mssqlserver12;UserID=cassyinput;Password=status1;Database=FFKMaster;Trusted_Connection=True;Integrated Security=SSPI;Provider=SQLOLEDB.1"
0
 
LVL 37

Accepted Solution

by:
Neil Russell earned 500 total points
ID: 40521595
NO.  You still have Trusted_Connection=True;Integrated Security=SSPI;  and that tells it to use windows integrated auth.

You need only have....

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
Password=myPassword;
0
 

Author Comment

by:ka8799
ID: 40523394
Thank you so much Neilsr... :) It is working fine now.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 37

Expert Comment

by:Neil Russell
ID: 40523404
You are welcome.
0
 

Author Comment

by:ka8799
ID: 40527708
Hi,

Actually now it is working with SQL authentication. Do you have any idea to work the same code with windows authentication? Is that need to change the above string for windows authentication?
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40527867
Are ALL of the servers on the same domain as domain servers and you can log into windows on them both as a domain administrator?
0
 

Author Comment

by:ka8799
ID: 40533099
I can login into windows as domain administrator in one server and i have windows authentication access for SQL server in another server(In this server, i am not a domain administrator).
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40533103
Two seperate domains?
0
 

Author Comment

by:ka8799
ID: 40539759
yes
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now