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
188 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 17

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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction (All good things must come to an end (http://en.wikipedia.org/wiki/All_Good_Things...))The original MySQL API (http://php.net/manual/en/book.mysql.php) has gone away, deprecated by PHP in Version 5.5, and removed from PHP in all current…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

808 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