UpdateProgress being used during postback.In localHost it works fine.In Web Hosting server, it is failing.
I am sending a mail and updating MS Accessn database during postback (which occurs during button click).
In localhost, it works fine and both actions are performed perfectly.But in web server, the updateprogress comes on for a second and then disappears, after that no action is performed.Please help!!
Public Sub SendMailMessage(ByVal from As String, ByVal recepient As String, ByVal bcc As String, ByVal cc As String, ByVal subject As String, ByVal body As String)
Dim mMailMessage As New MailMessage()
Dim cd As New ContentDisposition
mMailMessage.From =
New MailAddress(from, "Saurabh ")
mMailMessage.To.Add(
New MailAddress(recepient))
Dim atpath As String
atpath = System.Web.
HttpContext.Current.Server.MapPath("~/")
Dim at = New Attachment(atpath + "/attach/Saurabh.pdf")
cd = at.ContentDisposition
cd.FileName =
"Wedding-Card.pdf"
mMailMessage.Attachments.Add(at)
If Not bcc Is Nothing And bcc <> String.Empty Then
mMailMessage.Bcc.Add(
New MailAddress(bcc))
End If
If Not cc Is Nothing And cc <> String.Empty Then
mMailMessage.CC.Add(
New MailAddress(cc))
End If
mMailMessage.Subject = subject
mMailMessage.IsBodyHtml =
True
mMailMessage.Body = body
mMailMessage.Priority =
MailPriority.High
Dim mSmtpClient As New SmtpClient()
mSmtpClient.EnableSsl =
True
mSmtpClient.Send(mMailMessage)
End Sub
End
Class
Protected Sub button1_Click(sender As Object, e As System.EventArgs) Handles button1.Click
Dim mail_snd As New mail_helper
Dim msg_mail As New msgbox
Dim valid As Boolean
Dim numstr As String
Dim rn As New Random
Dim NUM As New Integer
Dim mailbody As String
Dim InsertString As String = "INSERT INTO Comments (GName, EmailID, Message, Comment_Date, embk) VALUES (@GName, @EmailID, @Message, @Comment_Date, @embk )"
Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("App_Data\wedsite.mdb"))
Dim cmd As New OleDb.OleDbCommand(InsertString, conn), mailmsg As New mail_helper
NUM = CType(Session.Item("field1"), Integer)
ind =True
If textbox1.Text <> "" And textbox2.Text <> "" And textbox3.Text <> "" And textbox4.Text <> "" Then
valid = mail_snd.IsValidEmail(textbox2.Text)
If valid = True Then
chkcap(textbox4.Text, NUM)
If ind = True Then
md.Parameters.AddWithValue("@GName", textbox1.Text)
If chkbox.Checked = False Then
cmd.Parameters.AddWithValue("@EmailID", textbox2.Text)
Else
cmd.Parameters.AddWithValue("@EmailID", "Not shown")
End If
cmd.Parameters.AddWithValue("@Message", textbox3.Text)
cmd.Parameters.AddWithValue("@Comment_Date",DateAndTime.Now.ToString)
cmd.Parameters.AddWithValue("@embk", textbox2.Text)
conn.Open()
cmd.ExecuteNonQuery()
cmd.Dispose()
conn.Close()
mailbody =
"<html><body><b>Dear" + " " + textbox1.Text + ", </b>" +
"<b>Please find the invitation attached here with this mail. I request you to please consider this as the personal invitation from me...!!!</b>" +
"<br/>" +
"<b>Saurabh</b>" +
"</body></html>"
mailmsg.SendMailMessage("saurabh@yahoo.com", textbox2.Text, "", "", "Invite", mailbody)
Response.Redirect("EmailConf.aspx?name=" + textbox1.Text +
"&email=" + textbox2.Text)
End If
Else
msg_mail.UserMsgBox(
Me, "Invalid Mail ID. Please check!")
End If
Else
numstr = "All fields are mandatory."
msg_mail.UserMsgBox(
Me, numstr)
End If
End Sub
In this case, you may debug by watch network requests and responses for example by fiddler, see if you are getting an error code. Also you may contact host providers asking if any configuration is needed.
bumba_asp
Member
8 Points
5 Posts
UpdateProgress and ModalPopup in ASP.Net Page?
Feb 08, 2012 09:31 AM|LINK
UpdateProgress being used during postback.In localHost it works fine.In Web Hosting server, it is failing.
I am sending a mail and updating MS Accessn database during postback (which occurs during button click).
In localhost, it works fine and both actions are performed perfectly.But in web server, the updateprogress comes on for a second and then disappears, after that no action is performed.Please help!!
bumba_asp
Member
8 Points
5 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 08, 2012 09:58 AM|LINK
Hi All,
I will also paste my code here so that it become clear to you:
<form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" > </asp:ScriptManager> <script type="text/javascript"> // var prm = Sys.WebForms.PageRequestManager.getInstance(); //Raised before processing of an asynchronous postback starts and the postback request is sent to the server. prm.add_beginRequest(BeginRequestHandler); // Raised after an asynchronous postback is finished and control has been returned to the browser. prm.add_endRequest(EndRequestHandler); function BeginRequestHandler(sender, args) { //Shows the modal popup - the update progress var popup = $find('<%= modalPopup.ClientID %>'); if (popup != null) { popup.show(); } } function EndRequestHandler(sender, args) { //Hide the modal popup - the update progress var popup = $find('<%= modalPopup.ClientID %>'); if (popup != null) { popup.hide(); } } </script> <div id="page"> <asp:UpdateProgress ID="UpdateProgress" runat="server"> <ProgressTemplate> <asp:Image ID="Image2" ImageUrl="~/images/waiting.gif" AlternateText="Processing" runat="server" /> <p style="color:Blue;font-size:smaller">Sending mail...</p> </ProgressTemplate> </asp:UpdateProgress> <asp:ModalPopupExtender ID="modalPopup" runat="server" TargetControlID="updateprogress" PopupControlID ="updateprogress" BackgroundCssClass="modalPopup" /> <div style="border:#961d29 solid 1px;padding:4px 6px 4px 6px"> <asp:UpdatePanel ID="pnlData" runat="server" UpdateMode="Conditional" > <ContentTemplate> <asp:Table ID="Table1" runat="server" CellPadding="15" GridLines="Both" HorizontalAlign="Center" BorderColor="#FF0066" BorderStyle="Double" Visible="False"> <asp:TableRow> <asp:TableCell><asp:Label runat="server" ID="label3" Text="Your Name" /></asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="textbox1" BackColor="#FF5050" ForeColor="#0000CC" AutoCompleteType="FirstName" /></asp:TableCell></asp:TableRow><asp:TableRow> <asp:TableCell><asp:Label runat="server" ID="label4" Text="Email ID" /></asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="textbox2" BackColor="#FF5050" CausesValidation="True" ForeColor="#0000CC" Font-Italic="True" AutoCompleteType="Email" /></asp:TableCell></asp:TableRow><asp:TableRow> <asp:TableCell><asp:Label runat="server" ID="label6" Text="Hide mail id" /></asp:TableCell><asp:TableCell><asp:CheckBox runat="server" ID="chkbox" BackColor="#FF5050" ForeColor="#0000CC" /></asp:TableCell></asp:TableRow><asp:TableRow> <asp:TableCell><asp:Label runat="server" ID="label5" Text="Your Message" /></asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="textbox3" BackColor="#FF5050" CausesValidation="True" ForeColor="#0000CC" Font-Italic="True" Height="100" Wrap="True" TextMode="MultiLine" AutoCompleteType="Notes" /></asp:TableCell></asp:TableRow><asp:TableRow> <asp:TableCell><asp:Image runat="server" ID="image1" Text="Enter The text from image" /></asp:TableCell><asp:TableCell><asp:TextBox runat="server" ID="textbox4" BackColor="#FF5050" ForeColor="#0000CC" ToolTip="Image text" /></asp:TableCell></asp:TableRow><asp:TableRow> <asp:TableCell><asp:Button runat="server" ID="button1" Text="Submit!" BackColor="Silver" BorderColor="Black" ForeColor="Black" UseSubmitBehavior="False" /></asp:TableCell> <asp:TableCell><asp:LinkButton ID="LinkButton1" runat="server" Font-Italic="True" PostBackUrl="~/ShowComments.aspx" ForeColor="#0066CC">See what others have wished..</asp:LinkButton></asp:TableCell></asp:TableRow></asp:Table></ContentTemplate></asp:UpdatePanel> </div>bumba_asp
Member
8 Points
5 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 08, 2012 10:11 AM|LINK
Code Behind:
Public Sub SendMailMessage(ByVal from As String, ByVal recepient As String, ByVal bcc As String, ByVal cc As String, ByVal subject As String, ByVal body As String) Dim mMailMessage As New MailMessage() Dim cd As New ContentDisposition mMailMessage.From = New MailAddress(from, "Saurabh ") mMailMessage.To.Add( New MailAddress(recepient)) Dim atpath As String atpath = System.Web. HttpContext.Current.Server.MapPath("~/") Dim at = New Attachment(atpath + "/attach/Saurabh.pdf") cd = at.ContentDisposition cd.FileName = "Wedding-Card.pdf" mMailMessage.Attachments.Add(at) If Not bcc Is Nothing And bcc <> String.Empty Then mMailMessage.Bcc.Add( New MailAddress(bcc)) End If If Not cc Is Nothing And cc <> String.Empty Then mMailMessage.CC.Add( New MailAddress(cc)) End If mMailMessage.Subject = subject mMailMessage.IsBodyHtml = True mMailMessage.Body = body mMailMessage.Priority = MailPriority.High Dim mSmtpClient As New SmtpClient() mSmtpClient.EnableSsl = True mSmtpClient.Send(mMailMessage) End Sub End Class Protected Sub button1_Click(sender As Object, e As System.EventArgs) Handles button1.Click Dim mail_snd As New mail_helper Dim msg_mail As New msgbox Dim valid As Boolean Dim numstr As String Dim rn As New Random Dim NUM As New Integer Dim mailbody As String Dim InsertString As String = "INSERT INTO Comments (GName, EmailID, Message, Comment_Date, embk) VALUES (@GName, @EmailID, @Message, @Comment_Date, @embk )" Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("App_Data\wedsite.mdb")) Dim cmd As New OleDb.OleDbCommand(InsertString, conn), mailmsg As New mail_helper NUM = CType(Session.Item("field1"), Integer) ind =True If textbox1.Text <> "" And textbox2.Text <> "" And textbox3.Text <> "" And textbox4.Text <> "" Then valid = mail_snd.IsValidEmail(textbox2.Text) If valid = True Then chkcap(textbox4.Text, NUM) If ind = True Then md.Parameters.AddWithValue("@GName", textbox1.Text) If chkbox.Checked = False Then cmd.Parameters.AddWithValue("@EmailID", textbox2.Text) Else cmd.Parameters.AddWithValue("@EmailID", "Not shown") End If cmd.Parameters.AddWithValue("@Message", textbox3.Text) cmd.Parameters.AddWithValue("@Comment_Date",DateAndTime.Now.ToString) cmd.Parameters.AddWithValue("@embk", textbox2.Text) conn.Open() cmd.ExecuteNonQuery() cmd.Dispose() conn.Close() mailbody = "<html><body><b>Dear" + " " + textbox1.Text + ", </b>" + "<b>Please find the invitation attached here with this mail. I request you to please consider this as the personal invitation from me...!!!</b>" + "<br/>" + "<b>Saurabh</b>" + "</body></html>" mailmsg.SendMailMessage("saurabh@yahoo.com", textbox2.Text, "", "", "Invite", mailbody) Response.Redirect("EmailConf.aspx?name=" + textbox1.Text + "&email=" + textbox2.Text) End If Else msg_mail.UserMsgBox( Me, "Invalid Mail ID. Please check!") End If Else numstr = "All fields are mandatory." msg_mail.UserMsgBox( Me, numstr) End If End Subsushanth009
Contributor
6243 Points
1168 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 08, 2012 07:45 PM|LINK
Try viewing your page in FireBug in Firefox. Go to console and check what is causing the post back and see if it is throwing any errors on the page.
salman beher...
All-Star
30711 Points
5871 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 09, 2012 06:09 AM|LINK
Hi,
fail means your mail sending fail or Modal displaying fail???
have you check that your mail is sending or not?
let me know first....
Thanks..
Sincerely,
Salman
chetan.sarod...
All-Star
65789 Points
11153 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 10, 2012 02:44 AM|LINK
Hi, Please refer my reply here
http://forums.asp.net/t/1115472.aspx/1
http://weblogs.asp.net/ruslan/pages/ajax-update-progress-updateprogress-in-ajax-modal-popup-modalpopupextender.aspx
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
bumba_asp
Member
8 Points
5 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 12, 2012 06:26 AM|LINK
Hi Everyone,
Its a strange problem. As required I had uploaded the AjaxToolkit files in the BIN folder of the server.
After doing this it works in my localhost sever, another free hosting server.Here both the database update is done and mail is sent.
But in the paid hosting, the ProgressUpdate shows for a second and disappears.No database update happens neither mail is sent.
Thanks,
Saurabh.
bumba_asp
Member
8 Points
5 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 12, 2012 06:30 AM|LINK
Hi Chetan,
I will be trying out your solution and will post here the result of the same.
Thanks,
Saurabh.
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 13, 2012 12:27 AM|LINK
Hello
In this case, you may debug by watch network requests and responses for example by fiddler, see if you are getting an error code. Also you may contact host providers asking if any configuration is needed.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
sushanth009
Contributor
6243 Points
1168 Posts
Re: UpdateProgress and ModalPopup in ASP.Net Page?
Feb 14, 2012 04:27 PM|LINK
Might be problem with Mutiple postback son the page.,.