Wednesday, March 9, 2011

Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out.

I saw this problem when i send a mail.The mail button withing a update panel and used a UpdatePanelAnimationExtender. This occured because mail operation relatively long 30 sec or more. What i did, there is a property called AsyncPostBackTimeOut in ScriptManager and set its timeout to 500. Default value is 90.

<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="500">
</asp:ScriptManager>
 

Monday, March 7, 2011

How to check a file if is in use


protected virtual bool IsFileLocked(FileInfo file)
    {
        FileStream stream = null;

        try
        {
            stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
        }
        catch (IOException)
        {
            //the file is unavailable because it is:
            //still being written to
            //or being processed by another thread
            //or does not exist (has already been processed)
            return true;
        }
        finally
        {
            if (stream != null)
                stream.Close();
        }

        //file is not locked
        return false;
    }

 

Firefox doesn't know how to open this address, because the protocol (d) isn't associated with any program.

I saw this error message when i was trying to open a PDF document which in web folder, to a new window. This will take place when you are trying to go to a link to a file on your local disk. In my application i gave the http path like this http://localhost:4150/Admin/doc/invoice/12.pdf. Its working now.
here another reference link
http://forums.mozillazine.org/viewtopic.php?f=38&t=617197

Open new window when button click within updatepanel


protected void printbtn_Click(object sender, ImageClickEventArgs e)
{
 StringBuilder sb = new StringBuilder();
 sb.Append("<script>");
 sb.Append("window.open('"+path+"', '', '');");
 sb.Append("</script>")
 ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "test", sb.ToString(), false);
}
 

TinyMCE Insert/Edit link not editable

 To fix this add  e.stopImmediatePropagation()  as below. $(document).on('focusin', function (e) {             if ($(e.target).close...