I have a custom HttpModule that filters out whitespace. When it is enabled, the progress dialog does not appear. I can't seem to figure out why. Here is the code along with the change to web.config. Please note that the whitespace code isn't even running on the upload.aspx page. The line of code that causes the progress bar to fail seems to be:
if (app.Request["HTTP_X_MICROSOFTAJAX"] != null) { return; }
If I put a "return;" immediately above this line, the progress dialog appears. If I put a "return;" immediately after this line, the progress dialog does NOT appear. How does the executing the above line of code cause the progress dialog to fail to appear?
Thanks for any insight into this issue. For now, I have to disable my whitespace httpmodule.
John
| <httpModules> |
| <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" /> |
| <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> |
| <add name="EntityTransactionModule" type="REO.Web.Data.EntityTransactionModule, REO.Web"/> |
| <add name="WhitespaceModule" type="WhitespaceModule"/> |
| </httpModules> |
| #region Using |
| using System; |
| using System.IO; |
| using System.Web; |
| using System.IO.Compression; |
| using System.Text.RegularExpressions; |
| #endregion |
| /// <summary> |
| /// Removes whitespace from the webpage. |
| /// </summary> |
| public class WhitespaceModule : IHttpModule |
| { |
| #region IHttpModule Members |
| void IHttpModule.Dispose() |
| { |
| // Nothing to dispose; |
| } |
| void IHttpModule.Init(HttpApplication context) |
| { |
| context.BeginRequest += new EventHandler(context_BeginRequest); |
| } |
| #endregion |
| void context_BeginRequest(object sender, EventArgs e) |
| { |
| HttpApplication app = sender as HttpApplication; |
| if (app.Request["HTTP_X_MICROSOFTAJAX"] != null) { return; } |
| string rawurl = app.Request.Path.ToLower(); |
| if (rawurl.EndsWith(".aspx") && !rawurl.ToLower().EndsWith("upload.aspx")) |
| { |
| app.Response.Filter = new WhitespaceFilter(app.Response.Filter); |
| } |
| } |
| #region Stream filter |
| private class WhitespaceFilter : Stream |
| { |
| public WhitespaceFilter(Stream sink) |
| { |
| _sink = sink; |
| } |
| private Stream _sink; |
| private static Regex reg = new Regex(@"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}"); |
| #region Properites |
| public override bool CanRead |
| { |
| get { return true; } |
| } |
| public override bool CanSeek |
| { |
| get { return true; } |
| } |
| public override bool CanWrite |
| { |
| get { return true; } |
| } |
| public override void Flush() |
| { |
| _sink.Flush(); |
| } |
| public override long Length |
| { |
| get { return 0; } |
| } |
| private long _position; |
| public override long Position |
| { |
| get { return _position; } |
| set { _position = value; } |
| } |
| #endregion |
| #region Methods |
| public override int Read(byte[] buffer, int offset, int count) |
| { |
| return _sink.Read(buffer, offset, count); |
| } |
| public override long Seek(long offset, SeekOrigin origin) |
| { |
| return _sink.Seek(offset, origin); |
| } |
| public override void SetLength(long value) |
| { |
| _sink.SetLength(value); |
| } |
| public override void Close() |
| { |
| _sink.Close(); |
| } |
| public override void Write(byte[] buffer, int offset, int count) |
| { |
| byte[] data = new byte[count]; |
| Buffer.BlockCopy(buffer, offset, data, 0, count); |
| string html = System.Text.Encoding.Default.GetString(buffer); |
| if (!html.Contains("textarea")) |
| { |
| html = reg.Replace(html, string.Empty); |
| } |
| byte[] outdata = System.Text.Encoding.Default.GetBytes(html); |
| _sink.Write(outdata, 0, outdata.GetLength(0)); |
| } |
| #endregion |
| } |
| #endregion |
| } |
<
telerik:GridButtonColumn CommandName="Delete" UniqueName="Delete" Text="Delete" ButtonType="ImageButton"
ImageUrl="~/Image/Delete.gif" ConfirmDialogType= "RadWindow" ConfirmText="Are you sure you want to delete this ?"
ItemStyle-Width="20px" HeaderStyle-Width="20px">
<ItemStyle HorizontalAlign="Center"/>
</telerik:GridButtonColumn>
This confirm window is popup but when I click OK or Cancel no response..It's only happening on my production machine, Windows server 2003 sp2 and browser is IE7. The same configuration is on test machine. its working with out any issues. scripting is enabled on browser.
Any idea..it's very urgent ..
Thanks!
i have something like this
If
RadScriptManager1.IsInAsyncPostBack Then
Dim clicked_item As String = "Product"
RadMenu1.FindItemByText(clicked_item).HighlightPath()
Else
Dim clicked_item As String = "Product"
RadMenu1.FindItemByText(clicked_item).HighlightPath()
end if
it will work fine if it is in the else statment but wont work when its in the if. Does this have to do with asyncpostback ? i think it is. so how do i solve this problem. thanks.

