Skip to main content

I ran into this use case the other day:

The client has a .NET app that is making web requests to OAM protected webpages from the server side and then including the rendered data to the page. So, they in effect, have to pass the ObSSOCookie that is in the users browser to the requested URL. Here’s the snippet of code that’ll do this for ya:

//Start : Handling add due to IAM implementation the Webrequest fails if the SSO key are not passed for processing.
if (HttpContext.Current.Request.Cookies[CookieNameKey.OAM_OBSSO] != null)
{
Cookie oCookie = new Cookie(CookieNameKey.OAM_OBSSO, HttpContext.Current.Request.Cookies[CookieNameKey.OAM_OBSSO].Value);
oRequest.CookieContainer.Add(uri, new Cookie(oCookie.Name, oCookie.Value));
oRequest.Headers.Add(CookieNameKey.OAM_OBSSO, oCookie.Value);
if (!String.IsNullOrEmpty(HttpContext.Current.Request.Headers.Get(HeaderVarKey.IAM_USER_ID)))
oRequest.Headers.Add(HeaderVarKey.IAM_USER_ID, HttpContext.Current.Request.Headers.Get(HeaderVarKey.IAM_USER_ID));
}
//End : Handling add due to IAM implementation the Webrequest fails if the SSO key are not passed for processing.

Cheers!