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 1 1130
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: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| | |