I am trying to setup a solution that will include a client which will access
a database via remoting calls. I am hosting my remoting project in IIS, and
am using Windows Integrated security. Since some of my users will be coming
in through the web (from non-trusted domains) to log into their local domain
account, I am trying to implement a login screen which will gather the user
data (login, pwd, domain). The login screen will be displayed only if the
user's default credentials do not authenticate. I have setup a small test
project to work out the kinks in the process, with the remoting part having
2 methods:
GetMessage() - Returns a string that includes the
HttpContext.Current.User.Identity.Name but has no
database access
GetMostExpensiveProducts - Creates a connection to the NorthWind
database and executes the
[Ten Most Expensive] stored procedure
I have found that if I allow the default credentials to go through, both
calls work correctly. However, when I create a set of credentials from the
login screen, the GetMessage shows the proper username (in domain\username
form) but the GetMostExpensiveProducts call errors with the following error
message:
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
The GetMostExpensiveProducts has the following connection string:
"Provider=SQLOLEDB;Data Source=Dev2k;Initial Catalog=Northwind;
Integrated Security=SSPI;Trusted_Connection=yes"
The code on the client to create and set the credentials looks like this:
Dim _NWInfo As iNWInfo
Dim serverCredentials As New NetworkCredential
Dim channelproperties As IDictionary
Dim serverURL As String =
"http://localhost/dotNET/RemotingTest/NWInfo.rem"
...
_NWInfo =
CType(Activator.GetObject(GetType(RemotingInterfac e.iNWInfo), serverURL),
RemotingInterface.iNWInfo)
channelproperties =
ChannelServices.GetChannelSinkProperties(_NWInfo)
'Comment out the next line to cause 401 error and force manual login
to happen
'channelproperties("credentials") =
CredentialCache.DefaultCredential
Try
txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage
Catch ex As System.Net.WebException When ex.Message.indexof("401") >
0
Dim loginDlg As New Login
loginDlg.ShowDialog()
If loginDlg.DialogResult = Windows.Forms.DialogResult.OK Then
serverCredentials.UserName = loginDlg.txtUserName.Text
serverCredentials.Password = loginDlg.txtPassword.Text
serverCredentials.Domain = loginDlg.txtDomain.Text
loginDlg.Close()
End If
channelproperties("credentials") = serverCredentials
txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage
Catch ex As System.Net.WebException When ex.Message.IndexOf("could
not be resolved") > 0
txtResults.Text += vbCrLf & "I couldn't find the server you
specified: " & serverURL
Catch ex As Exception
txtResults.Text = txtResults.Text & vbCrLf & ex.Message & vbCrLf
& ex.Source & vbCrLf & _
GetType(Exception).ToString
End Try
txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage
Can anyone tell me what I am doing wrong here?
TIA
Ron L 2 3107
I think I found the problem. I had the <identity impersonate="true">
directive in the system.runtime.remoting | application | Channels section of
my Web.Config. When I copied it the System.Web section, my connection
started to work.
Ron L
"Ron L" <ro**@bogus.Address.com> wrote in message
news:u$**************@TK2MSFTNGP10.phx.gbl... I am trying to setup a solution that will include a client which will access a database via remoting calls. I am hosting my remoting project in IIS, and am using Windows Integrated security. Since some of my users will be coming in through the web (from non-trusted domains) to log into their local domain account, I am trying to implement a login screen which will gather the user data (login, pwd, domain). The login screen will be displayed only if the user's default credentials do not authenticate. I have setup a small test project to work out the kinks in the process, with the remoting part having 2 methods: GetMessage() - Returns a string that includes the HttpContext.Current.User.Identity.Name but has no database access GetMostExpensiveProducts - Creates a connection to the NorthWind database and executes the [Ten Most Expensive] stored procedure
I have found that if I allow the default credentials to go through, both calls work correctly. However, when I create a set of credentials from the login screen, the GetMessage shows the proper username (in domain\username form) but the GetMostExpensiveProducts call errors with the following error message: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
The GetMostExpensiveProducts has the following connection string: "Provider=SQLOLEDB;Data Source=Dev2k;Initial Catalog=Northwind; Integrated Security=SSPI;Trusted_Connection=yes"
The code on the client to create and set the credentials looks like this: Dim _NWInfo As iNWInfo Dim serverCredentials As New NetworkCredential Dim channelproperties As IDictionary Dim serverURL As String = "http://localhost/dotNET/RemotingTest/NWInfo.rem"
...
_NWInfo = CType(Activator.GetObject(GetType(RemotingInterfac e.iNWInfo), serverURL), RemotingInterface.iNWInfo)
channelproperties = ChannelServices.GetChannelSinkProperties(_NWInfo) 'Comment out the next line to cause 401 error and force manual login to happen 'channelproperties("credentials") = CredentialCache.DefaultCredential
Try txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage Catch ex As System.Net.WebException When ex.Message.indexof("401") > 0 Dim loginDlg As New Login loginDlg.ShowDialog() If loginDlg.DialogResult = Windows.Forms.DialogResult.OK Then serverCredentials.UserName = loginDlg.txtUserName.Text serverCredentials.Password = loginDlg.txtPassword.Text serverCredentials.Domain = loginDlg.txtDomain.Text loginDlg.Close() End If channelproperties("credentials") = serverCredentials
txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage Catch ex As System.Net.WebException When ex.Message.IndexOf("could not be resolved") > 0 txtResults.Text += vbCrLf & "I couldn't find the server you specified: " & serverURL Catch ex As Exception txtResults.Text = txtResults.Text & vbCrLf & ex.Message & vbCrLf & ex.Source & vbCrLf & _ GetType(Exception).ToString End Try txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage
Can anyone tell me what I am doing wrong here?
TIA Ron L
I think I found the problem. I had the <identity impersonate="true">
directive in the system.runtime.remoting | application | Channels section of
my Web.Config. When I copied it the System.Web section, my connection
started to work.
Ron L
"Ron L" <ro**@bogus.Address.com> wrote in message
news:u$**************@TK2MSFTNGP10.phx.gbl... I am trying to setup a solution that will include a client which will access a database via remoting calls. I am hosting my remoting project in IIS, and am using Windows Integrated security. Since some of my users will be coming in through the web (from non-trusted domains) to log into their local domain account, I am trying to implement a login screen which will gather the user data (login, pwd, domain). The login screen will be displayed only if the user's default credentials do not authenticate. I have setup a small test project to work out the kinks in the process, with the remoting part having 2 methods: GetMessage() - Returns a string that includes the HttpContext.Current.User.Identity.Name but has no database access GetMostExpensiveProducts - Creates a connection to the NorthWind database and executes the [Ten Most Expensive] stored procedure
I have found that if I allow the default credentials to go through, both calls work correctly. However, when I create a set of credentials from the login screen, the GetMessage shows the proper username (in domain\username form) but the GetMostExpensiveProducts call errors with the following error message: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
The GetMostExpensiveProducts has the following connection string: "Provider=SQLOLEDB;Data Source=Dev2k;Initial Catalog=Northwind; Integrated Security=SSPI;Trusted_Connection=yes"
The code on the client to create and set the credentials looks like this: Dim _NWInfo As iNWInfo Dim serverCredentials As New NetworkCredential Dim channelproperties As IDictionary Dim serverURL As String = "http://localhost/dotNET/RemotingTest/NWInfo.rem"
...
_NWInfo = CType(Activator.GetObject(GetType(RemotingInterfac e.iNWInfo), serverURL), RemotingInterface.iNWInfo)
channelproperties = ChannelServices.GetChannelSinkProperties(_NWInfo) 'Comment out the next line to cause 401 error and force manual login to happen 'channelproperties("credentials") = CredentialCache.DefaultCredential
Try txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage Catch ex As System.Net.WebException When ex.Message.indexof("401") > 0 Dim loginDlg As New Login loginDlg.ShowDialog() If loginDlg.DialogResult = Windows.Forms.DialogResult.OK Then serverCredentials.UserName = loginDlg.txtUserName.Text serverCredentials.Password = loginDlg.txtPassword.Text serverCredentials.Domain = loginDlg.txtDomain.Text loginDlg.Close() End If channelproperties("credentials") = serverCredentials
txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage Catch ex As System.Net.WebException When ex.Message.IndexOf("could not be resolved") > 0 txtResults.Text += vbCrLf & "I couldn't find the server you specified: " & serverURL Catch ex As Exception txtResults.Text = txtResults.Text & vbCrLf & ex.Message & vbCrLf & ex.Source & vbCrLf & _ GetType(Exception).ToString End Try txtResults.Text = txtResults.Text & vbCrLf & _NWInfo.GetMessage
Can anyone tell me what I am doing wrong here?
TIA Ron L This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Linesh Gajera |
last post by:
Hi,
I have unique problem. I have configured RemotingServer running as
Console Application and my Remoting object access Oracle database. My
remoting object make call to Oracle database and...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool
This article makes a detailed comparison among SourceAnyWhere,
SourceOffSite, VSS...
|
by: Ron L |
last post by:
I am trying to setup a solution that will include a client which will access
a database via remoting calls. I am hosting my remoting project in IIS, and
am using Windows Integrated security. ...
|
by: mayamorning123 |
last post by:
A comparison among six VSS remote tools including SourceOffSite ,
SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET
To view the full article, please visit...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere
and VSS Remoting
This article makes a detailed...
|
by: Buzz Bonner |
last post by:
Hi,
We have developed a distributed system that uses multiple .NET remoting
servers hosted by Windows Services. However, the single server used for
performing all database access using ADO.NET...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool
This article makes a detailed comparison among SourceAnyWhere,
SourceOffSite, VSS...
|
by: Wendy Elizabeth |
last post by:
I want a Visual Basic 6.0 web or desk top application to communicate with a
Visual Basic.NET web or desktop application. I also want a Visual Basic.NET
web or windows
application to communicate...
|
by: miha.valencic |
last post by:
Hi!
What are the options for securing remote objects, which are accessible
through IIS, when you have an application deployed on the same server,
which uses custom Forms authentication?
...
|
by: Ron L |
last post by:
I am working on an application that is a front-end for a SQL database.
While it is not an immediate requirement, the application will probably be
required to be able to connect via the internet at...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| | |