jump to navigation

WebHttpBinding “HttpContext.Current” null WCF SharePoint October 20, 2016

Posted by juanpablo1manrique in SharePoint.
Tags:
trackback

Desafortunadamente WCF no soporta estado y en SharePoint todos los trucos posibles no funcionaron,

[ServiceContract(Namespace = “”)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class MiService : ServiceBase

Tambien intente.

string cookieHeader = WebOperationContext.Current.IncomingRequest.Headers[HttpRequestHeader.Cookie];
// Here you can see the OutgoingResponse Header has set the cookies.
Match match = Regex.Match(cookieHeader, @”^SessionID=(?.*)$”);
if (match.Success)
{

//YEAH!!! I get it; but nop, never passed this way,
throw new Exception(match.Groups[“SessionID”].Value);
}
else
{
WebOperationContext.Current.OutgoingResponse.Headers[HttpResponseHeader.SetCookie] = cookieHeader + “;” + string.Format(“SessionID={0}”, “MIDATOAGUARDAR”);
}

Y tampoco,

Si saben algo me cuentan

 

SOLUCION

Una solucion que encontre para este caso es la siguiente,

ObtenerObjeto de negocio -> enviarlo como entrada en todos los métodos siguientes.

Finalmente en la nueva programación FronEnd ya no utilizamos el aburrido ViewState, así que manejamos el estado nosotros mismos,

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: