October 19, 2010

0 Determining Identity in a Visual Basic 6 COM Object

Determining Identity in a Visual Basic 6 COM Object

The following method can be used to return the identity of a Visual Basic 6 COM
object. You can call Visual Basic 6.0 COM objects directly from ASP.NET applications
through COM interop. The following method can be helpful when you need to
troubleshoot access denied errors from your component when it attempts to access
resources.
Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function WhoAmI()
Dim sBuff As String
Dim lConst As Long
Dim lRet As Long
Dim sName As String
lConst = 199
sBuff = Space$(200)
lRet = GetUserName(sBuff, lConst)
WhoAmI = Trim$(Left$(sBuff, lConst))
End Function

.NET Remoting

If a remote object is hosted in ASP.NET, and is configured for Windows
authentication, you must specify the credentials to be used for authentication
through the credentials property of the channel. If you do not explicitly set
credentials, the remote object is called without any credentials. If Windows
authentication is required, this will result in an HTTP status 401, access denied
response.

To use the credentials associated with the current thread impersonation token (if the
client thread is impersonating), or the process token (with no impersonation), use
default credentials. This can be configured in the client-side configuration file using
the following setting:

<channel ref="http" useDefaultCredentials="true" />
If an ASP.NET Web application calls a remote component and the Web application is
configured for impersonation, the Web application must be using Kerberos or Basic
authentication. All other authentication types can not be used in delegation scenarios.

If the Web application is not configured for impersonation, the process identity of
the ASP.NET worker process is used. This is specified on the <processModel>
element of machine.config and defaults to the local ASPNET account.

Note: Ensure the process in running under an account that can be authenticated by the remote
computer.

0 comments:

Post a Comment

Blogger Themes

 
Powered by Blogger