Child pages
  • SampleCodeProcessingIWSResponse
Skip to end of metadata
Go to start of metadata

Sample code in C# processing IWS response

IwsResponse rsp = ws.VerifySession(isisTicket, Request.ServerVariables["remote_addr"], true);

if (rsp.sessionInfo != null)
{
	if ((rsp.sessionInfo.status == ActiveWithMultipleCredentials) || 
		(rsp.sessionInfo.status == Active) || 
		(rsp.sessionInfo.status == ActiveWithCachedCredentials))
	{
		if (rsp.hasErrors == true)
		{
			for (int n = 0; n < rsp.errorInfo.count; n++)
			{
				if (rsp.errorInfo.errors[n].errorCode == 904099)
				{
					//user ip changed but passed ip check. session is active. It's 
					//recommended to log this fact.
				}
                                else //some other errors
                                {
                                     //log error and do what needs to be done.
                                }  
			}
		}
	}

	else //session status is not active.
	{
		if (rsp.hasErrors == true)
		{
			for (int n = 0; n < rsp.errorInfo.count; n++)
			{
				if (rsp.errorInfo.errors[n].errorCode == 604010)
				{
					//user ip changed. session is terminated. Let user know the reason and provide work around.
				}
                                else //some other errors
                                {
                                     //log error and do what needs to be done.
                                }
			}
		}
	}
}

else //for some reason, rsp sessionInfo has nothing in it. check for errors.
{
	if (rsp.hasErrors == true)
	{
		//check for errors
		for (int n = 0; n < rsp.errorInfo.count; n++)
		{
			int errorCode = rsp.errorInfo.errors[n].errorCode;
			string errorMsg = rsp.errorInfo.errors[n].detail;
			//code for error handling.
		}
	}
}