public override string ToString()
{
if (this.Script.IsNotEmpty() && !this.Script.StartsWith("<string>"))
{
this.Script = "<string>" + this.Script;
}
string serialize = new ClientConfig().Serialize(this);
if (!this.internalUsing && (this.IsUpload || this.NativeUpload))
{
serialize = "<textarea>{0}</textarea>".FormatWith(serialize);
}
if (!this.internalUsing && HttpContext.Current != null && HttpContext.Current.CurrentHandler is Page)
{
HttpContext.Current.Items["Ext.Net.Direct.Response.Manual"] = true;
return "<Ext.Net.Direct.Response.Manual>".ConcatWith(serialize, "</Ext.Net.Direct.Response.Manual>");
}
return serialize;
}
private void RedirectPreSendRequestHeaders(object sender, EventArgs e) { HttpApplication app = sender as HttpApplication; HttpContext context = app.Context; if (context.Response.StatusCode == 302) { if (RequestManager.HasXHeader(context.Request) || RequestManager.HasInputFieldMarker(context.Request)) { string url = context.Response.RedirectLocation; context.Response.StatusCode = 200; context.Response.SuppressContent = false; context.Response.ContentType = "text/html"; context.Response.Charset = "utf-8"; context.Response.ClearContent(); DirectResponse responseObject = new DirectResponse(true); responseObject.Script = "window.location=\"".ConcatWith(url, "\";"); TextWriter writer = context.Response.Output; writer.Write(responseObject.ToString()); } } }