Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Moving from 2003 to 2008 R2

$
0
0

Hi All,

I have ASP.net application developed in .net framework 2.0, running very well on windows server 2003.  Now I am planning to move this application on windows 2008 R2 server (framework 2.0).

The application uses CustomIdentity class that implements IIdentity interface,  inherits MarshalByRefObject class and CustomPrincipal class implements IPrincipal, inherits MarshalByRefObject 

public class CustomIdentity : MarshalByRefObject, IIdentity
{
//code
}

public class CustomPrincipal : MarshalByRefObject, IPrincipal
{
//code
}

After successful login, user's information is saved in the instance of CustomIdentity class

CustomIdentity _objUserIdentity = new CustomIdentity(_strUserId,
                    _isUserAuthenticated, true, _strEmail, _strRoles.ToString(),
                    _strEntitlements.ToString(), _strCode,
                    _strDesignation, _strSupervisorUserID, _intCompanyID,
                    _intLocationID, _intDepartmentID, _strGender, _strDateOfJoin);

                    // Creating Object of CustomPrincipal class
                    CustomPrincipal _objPrincipal = new CustomPrincipal(_objUserIdentity,
                        _arrRoles, _arrEntitlements, _arrAppCode);

                    // Assigning CustomPrincipal object to Context
                    Context.User = _objPrincipal;

                    CustomAuthentication.RedirectFromLoginPage(_objUserIdentity);

On each page, the user's information is access as shown below.

string UserID = ((CustomIdentity)Thread.CurrentPrincipal.Identity).UserID;

This code runs good on Window Server 2003 (framework 2.0), but given following error on Windows Server 2008 R2 (framework 2.0)

Unable to cast object of type 'System.Security.Principal.WindowsIdentity' to type 'CustomIdentity'.

Any idea how to resolve this?



Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>