Logo 
Search:

Sharepoint 2010 Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint 2010       RSS Feeds

Issue with Custom Claims provider / WIF. Sharepoint 2010

  Asked By: Pablo    Date: Oct 06    Category: Sharepoint 2010    Views: 2023


Hi.
I implemented a custom claims provider in Sharepoint 2010.
My current issue is that when I leave the sharepoint application open for around 40 minutes (so the session ends), once I refresh the page it gives me this error:


Server Error in '/IWeb.STS' Application.

--------------------------------------------------------------------------------

Unable to cast object of type 'Microsoft.IdentityModel.Protocols.WSFederation.SignInRequestMessage' to type 'Microsoft.IdentityModel.Protocols.WSFederation.SignOutRequestMessage'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'Microsoft.IdentityModel.Protocols.WSFederation.SignInRequestMessage' to type 'Microsoft.IdentityModel.Protocols.WSFederation.SignOutRequestMessage'.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[InvalidCastException: Unable to cast object of type 'Microsoft.IdentityModel.Protocols.WSFederation.SignInRequestMessage' to type 'Microsoft.IdentityModel.Protocols.WSFederation.SignOutRequestMessage'.]
IWeb.STS.Default.Page_PreRender(Object sender, EventArgs e) +365
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnPreRender(EventArgs e) +8687558
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

Unable to cast object of type 'Microsoft.IdentityModel.Protocols.WSFederation.SignInRequestMessage' to type 'Microsoft.IdentityModel.Protocols.WSFederation.SignOutRequestMessage'.


I'm researching about it but can't find any solution.

This is the code that handles this:

private void SingOutProcess()
{
this.logger.Debug("Processing SignOut action");

// Process signout request.
SignOutRequestMessage requestMessage = (SignOutRequestMessage)WSFederationMessage.CreateFromUri(Request.Url);
FederatedPassiveSecurityTokenServiceOperations.ProcessSignOutRequest(requestMessage, User, requestMessage.Reply, Response);
}

private void SignInProcess()
{
// Process signin request.
SignInRequestMessage requestMessage = (SignInRequestMessage)WSFederationMessage.CreateFromUri(Request.Url);

this.logger.Debug("Request.Url ->" + Request.Url);

if (User != null && User.Identity != null && User.Identity.IsAuthenticated)
{
this.logger.Debug("Processing SignIn action");

SecurityTokenService sts = new CustomSecurityTokenService(CustomSecurityTokenServiceConfiguration.Current);
SignInResponseMessage responseMessage = FederatedPassiveSecurityTokenServiceOperations.ProcessSignInRequest(requestMessage, User, sts);

this.logger.Debug("ProcessSignInResponse");

FederatedPassiveSecurityTokenServiceOperations.ProcessSignInResponse(responseMessage, Response);

this.logger.Debug("Finish SignInProcess");
}
else
{
string messageError = "User unauthorized to Access";
UnauthorizedAccessException ex = new UnauthorizedAccessException(messageError);

this.logger.ErrorException(messageError, ex);

throw ex;
}
}


Thanks!

Pablo

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Issue with Custom Claims provider / WIF. Sharepoint 2010 Or get search suggestion and latest updates.




Tagged: