I'm getting an exception trying to cast User to an ICasPrincipal: System.InvalidCastException: Unable to cast object of type 'System.Web.Security.RolePrincipal' to type 'DotNetCasClient.Security.ICasPrincipal'.
Here's the specific line: ICasPrincipal p = (ICasPrincipal)HttpContext.Current.User; It wasn't happy with var p -- "the type or namespace name 'var' could not be found". I'm guessing var is what would be used for VB, and a type must be given for C#. On May 22, 2013, at 7:27 PM, Scott <[email protected]<mailto:[email protected]>> wrote: Hi, You'll need to cast HttpContext.Current.User.Identity to IPrincipal. So depending on where your code is running, one of these should do the trick. var casPrincipal = (ICasPrincipal) User; var casPrincipal = (ICasPrincipal) HttpContext.Current.User; -ScottH On Wed, May 22, 2013 at 5:22 PM, Brian Davidson <[email protected]<mailto:[email protected]>> wrote: Sorry for my complete lack of C#/.Net knowledge. Is an instance of ICasPrincipal is required to read SAML attributes? If so, how does one obtain an instance of ICasPrincipal? If not, how does one go about reading an attribute such as "fullName" (assuming that's one in our SAML tickets)? Thanks! Brian -- You are currently subscribed to [email protected]<mailto:[email protected]> as: [email protected]<mailto:[email protected]> To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user -- You are currently subscribed to [email protected]<mailto:[email protected]> as: [email protected]<mailto:[email protected]> To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user -- You are currently subscribed to [email protected] as: [email protected] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user
