System.Web.Handlers.ScriptModule.PreSendRequestHeaders C# (CSharp) Method

PreSendRequestHeaders() private method

private PreSendRequestHeaders ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
		void PreSendRequestHeaders (object sender, EventArgs e) {
			HttpApplication app = (HttpApplication) sender;
			HttpContext context = app.Context;
			if (context.Request.Headers ["X-MicrosoftAjax"] == "Delta=true") {
				Page p = context.CurrentHandler as Page;
#if TARGET_J2EE
				if (p == null && context.CurrentHandler is IServiceProvider)
					p = (Page) ((IServiceProvider) context.CurrentHandler).GetService (typeof (Page));
#endif
				if (p == null)
					return;
				ScriptManager sm = ScriptManager.GetCurrent (p);
				if (sm == null)
					return;
				if (context.Response.StatusCode == 302) {
					context.Response.StatusCode = 200;
					context.Response.ClearContent ();
					if (context.Error == null || sm.AllowCustomErrorsRedirect)
						ScriptManager.WriteCallbackRedirect (context.Response.Output, context.Response.RedirectLocation);
					else
						sm.WriteCallbackException (context.Response.Output, context.Error, false);
				}
				else if (context.Error != null) {
					context.Response.StatusCode = 200;
					context.Response.ClearContent ();
					sm.WriteCallbackException (context.Response.Output, context.Error, true);
				}
			}
		}