Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland asked on

ASP.net Login failed. The login is from an untrusted domain

Hi

I am using the code below to load a GridView. My SQL database is on a server in South Africa and the web app is in Azure. I get the following error
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. dr2

The published web page is office2web.azurewebsites.net/contact
The strange thing is that another azure web app of mine works just fine with a database on the server so it must be something to do with the web app. The web app is http://steelyard.azurewebsites.net/

Imports System.Data.SqlClient
Public Class Contact
    Inherits Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

        If Not IsPostBack Then
            Call Bind_Grid_to_Dataview(Me.GridView1, "Select * From Customers")
        End If

    End Sub

    Sub Bind_Grid_to_Dataview(ByVal oGridView As GridView, ByVal oSQL As String)
        Try


            Dim cs As String = ConfigurationManager.ConnectionStrings("PSQL").ConnectionString
            Dim objCon As New SqlConnection 'Declaring connection object
            objCon.ConnectionString = cs
            'opening connection
            If objCon.State = ConnectionState.Closed Then
                objCon.Open()
            End If
            'declaring new Data Adapter
            Dim objDA As New SqlDataAdapter
            objDA.SelectCommand = New SqlCommand(oSQL, objCon)
            Dim objDS As New DataSet
            objDA.Fill(objDS)
            'Call oCheck_DataSet_For_Blank_Columns(objDS)
            'Below i am creating a default view of the Data Set
            Dim objDV As DataView = objDS.Tables(0).DefaultView
            Session("objDV") = objDV
            oGridView.DataSource = objDV
            oGridView.DataBind()

        Catch ex As Exception
            Response.Write(ex.Message & " dr2")
        End Try
    End Sub
End Class

Open in new window

ASP.NETMicrosoft SQL Server

Avatar of undefined
Last Comment
Ron Malmstead

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bembi

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Ron Malmstead

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy