Link to home
Start Free TrialLog in
Avatar of jeremyBass26
jeremyBass26Flag for United States of America

asked on

an email form that works for a bit then stops with a server error after a few runs...

Hello, I have an email form in .aspx that works for a bit then stops with a server error after a few runs... It emails out to me ... I tested it repeatedly... and all same like it was working... (I log in to vpn) When I run it from the inside of the network it's all "Runtime Error"... but it says the custom error settings for this app prevents a description... yeah... It's not my network... I'm just trying to place this file...

Also I tried a CDONTS form and a CDOSYS form which both didn't work... errr

Thanks for the help...
jeremyBass


The script (it works form the outside till it run from the inside, then never more)

<% @Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">
 
Sub btnSendFeedback_Click(sender as Object, e as EventArgs)
 
  'Create an instance of the MailMessage class
  Dim objMM as New MailMessage()
 
  'Set the properties - send the email to the person who filled out the
  'feedback form.
  objMM.To = "****@****.net"
  objMM.From = txtEmail.Text
 
  'If you want to CC this email to someone else, uncomment the line below
  objMM.Cc = "****@****.org"
 
  'If you want to BCC this email to someone else, uncomment the line below
  objMM.Bcc = "****@****.org"
 
  'Send the email in text format
  objMM.BodyFormat = MailFormat.Text
  '(to send HTML format, change MailFormat.Text to MailFormat.Html)
 
  'Set the priority - options are High, Low, and Normal
  objMM.Priority = MailPriority.Normal
 
  'Set the subject
  objMM.Subject = "test"
 
  'Set the body
  objMM.Body = "At " + DateTime.Now + " feedback was sent from an ASP.NET " & _
               "Web page.  Below you will find the feedback message " & _
               "send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
               "---------------------------------------" & vbCrLf & vbCrLf & _
			   Module_Selection.SelectedItem.Text & vbCrLf & vbCrLf & _
			   RequestType.SelectedItem.Text & vbCrLf & vbCrLf & _
			   Category_Selection.SelectedItem.Text & vbCrLf & vbCrLf & _
			   txtMessage.Text & vbCrLf & vbCrLf & _
			   "Contact Information: " & vbCrLf & vbCrLf & _
			   txtEmail.Text & vbCrLf & vbCrLf & _
			   Phone.Text & vbCrLf & vbCrLf
 
 
 
  
  'Specify to use the default Smtp Server
  SmtpMail.SmtpServer = ""
  
  'Now, to send the message, use the Send method of the SmtpMail class
  SmtpMail.Send(objMM)
 
 
  panelSendEmail.Visible = false
  panelMailSent.Visible = true
End Sub
 
</script>
 
<html>
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Clinical Documentation Process Feedback Form</title>
</head>
<body bgcolor="#D9C6A7" link="#000080" vlink="#000080" alink="#FF0000">
 
<table border="0" id="table1" bgcolor="#FFFFFF" cellpadding="2">
	<tr>
		<td>
		<img border="0" src="NewSite/images/sjrmcmasthead.jpg" width="757" height="100"></td>
	</tr>
	<tr>
		<td>
		<p align="right"><b><font face="Georgia" size="2">
		<a href="~default.asp">
		Home Page</a></font></b></td>
	</tr>
	<tr>
		<td bgcolor="#6799CC">&nbsp;</td>
	</tr>
	<tr>
		<td bgcolor="#C3DAF9"><u><b><font face="Arial">Clinical Documentation 
		Feedback Form</font></b></u><p><b><font face="Arial">This Form is not to be used 
		for questions critical to the immediate care of the patient.<br>
		If this is a question that requires an immediate response please contact 
		a Superuser in your area.</font></b></p>
		<p><font face="Arial">This form was 
		developed to help us continue to improve the clinical documentation 
		process within<br>
		the limitations of Meditech.</font></p><hr>
	<p><strong>Date/Time: </strong></p>
		<blockquote>
		<table border="1" id="table2" bordercolorlight="#000000" cellspacing="0" cellpadding="3" bordercolordark="#C0C0C0" bgcolor="#FFFFFF" bordercolor="#808080">
			<tr>
				<td><strong style="font-weight: 400"><script type="text/javascript">
var d = new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
document.write(weekday[d.getDay()] + " ")
document.write(d.getDate() + ". ")
document.write(monthname[d.getMonth()] + " ")
document.write(d.getFullYear())
 
</script>&nbsp;&nbsp;&nbsp;  @ 
<script type="text/javascript">
var d = new Date()
document.write(d.getHours())
document.write(".")
document.write(d.getMinutes() + 1)
document.write(".")
document.write(d.getSeconds())
</script></strong>
				</td>
			</tr>
		</table>
	</blockquote>
		<p>
          <asp:panel id="panelSendEmail" runat="server">
    <form runat="server">
      <h2>We are interested in your feedback!  Please enter the following
      requested information below to send us your comments.</h2>
 
<p><strong>Select Module:</strong></p>      
   <asp:DropDownList ID="Module_Selection" runat="server">
    <asp:ListItem value="NUR">Nursing (NUR)</asp:ListItem>
    <asp:ListItem value="BMV">Bedside Medication Verification (BMV)</asp:ListItem>
    <asp:ListItem value="eMAR">Electronic Medication Administration Record (eMAR)</asp:ListItem>
  </asp:DropDownList>     
 
<p><strong>Choose Request Type:</strong></p>
<asp:RadioButtonList ID="RequestType" runat="server"> 
 
<asp:ListItem value="Problem">Problem</asp:ListItem> 
 
<asp:ListItem value="Question">Question</asp:ListItem> 
 
<asp:ListItem value="Information">Information</asp:ListItem> 
 
<asp:ListItem value="Other">Other</asp:ListItem> 
 
</asp:RadioButtonList> 
 
 
<br/><br/>
 
 
 
   <asp:DropDownList ID="Category_Selection" runat="server">
			<asp:ListItem value="Allergies">Allergies</asp:ListItem>
			<asp:ListItem value="Admin_Data">Admin Data</asp:ListItem>
			<asp:ListItem value="Armbands">Armbands</asp:ListItem>
			<asp:ListItem value="Assessments">Assessments</asp:ListItem>
			<asp:ListItem value="Attributes">Attributes</asp:ListItem>
			<asp:ListItem value="CDS">CDS</asp:ListItem>
			<asp:ListItem value="Directions">Directions</asp:ListItem>
			<asp:ListItem value="Documenting_interventions_/_goals">Documenting interventions / goals</asp:ListItem>
			<asp:ListItem value="eMAR">eMAR</asp:ListItem>
			<asp:ListItem value="Flowsheet">Flowsheet</asp:ListItem>
			<asp:ListItem value="Hardware">Hardware</asp:ListItem>
			<asp:ListItem value="Interventions">Interventions</asp:ListItem>
			<asp:ListItem value="Kardex">Kardex</asp:ListItem>
			<asp:ListItem value="My_List">My List</asp:ListItem>
			<asp:ListItem value="Notes">Notes</asp:ListItem>
			<asp:ListItem value="Other">Other</asp:ListItem>
			<asp:ListItem value="Plan_of_Care">Plan of Care</asp:ListItem>
			<asp:ListItem value="Prints_Reports">Prints Reports</asp:ListItem>
			<asp:ListItem value="Process_Interventions">Process Interventions</asp:ListItem>
			<asp:ListItem value="Review_PCI">Review (PCI)</asp:ListItem>
			<asp:ListItem value="References">References</asp:ListItem>
			<asp:ListItem value="Scanning_Medications">Scanning Medications</asp:ListItem>
			<asp:ListItem value="Status_Board">Status Board</asp:ListItem>
			<asp:ListItem value="Worklist">Worklist</asp:ListItem>
     </asp:DropDownList>
     
            <p><b>Type your detailed description in the space provided below:</b><br>
      <asp:textbox id="txtMessage" TextMode="MultiLine" Columns="40" Rows="10" runat="server" /></p>
      
	<p><strong>If you are requesting a response, please include your contact 
	information below:<br>
	(Note: A minimum response time is one week.)</strong></p>    
      <p> 
       <b>Your Name:</b>
      <asp:textbox id="txtName" runat="server" />
      <br>
             <b>Phone Number:</b>
      <asp:textbox id="Phone" runat="server" />
      <br>
 
      <b>Your Email Address:</b>
      <asp:textbox id="txtEmail" runat="server" />
      </p>
 
          
            
      <asp:button runat="server" id="btnSendFeedback" Text="Send Feedback!"
                  OnClick="btnSendFeedback_Click" />
    </form>
  </asp:panel>
 
 
  <asp:panel id="panelMailSent" runat="server" Visible="False">
    An email has been sent to the email address you specified.  Thanks!
  </asp:panel>
        
        
		</p>
<hr>
		</td>
	</tr>
	<tr>
		<td bgcolor="#6799CC">&nbsp;</td>
	</tr>
</table>
 
 
</body>
 
</html>

Open in new window

Avatar of samtran0331
samtran0331
Flag of United States of America image

It looks like you're using Dreamweaver...as such...I can't really tell if this is ASP.Net 1.x or 2.0?
I'm guessing 1.x since you're using System.Web.Mail instead of System.Net.Mail?

Also, if you have access to the web server and app, is custom errors set to off in the web.config?
If not, if you change it to "off" , you might get a more informative error message...

If it is already set to "off"...you could try using some try/catch blocks to see exactly where it breaks...since if you are using Dreamweaver you can't really debug...
Avatar of jeremyBass26

ASKER

samtran0331.... thanks I total forgot to remove them...
Yes I am using Deamweaver...
>>>System.Web.Mail instead of System.Net.Mail
heck I don't know on that...

>>>is custom errors set to off
that is what the run time says is the case...

>>>you could try using some try/catch blocks
where could I find info on how to do this?

Sorry Asp is green to me... I know php lol... Any help here is greatly apperated here as, this is not something I should be doing... but I have no choice...

Thanks for the help here...
jeremyBass
>>heck I don't know on that...
If you have access to the app's IIS, then go to the properties for the app and there is a tab for ASP.Net and it tells you what version you're running the app under.
I'm going to guess it's 1.x though.

>>that is what the run time says is the case...
Certain errors will tell you that you need to turn off custom errors even though they are off.
Best bet is to check the actual web.config file to see the setting.

>>where could I find info on how to do this?
below is an example of your button routine with one big try/catch that would catch most all errors in the sub.
also there is an example of a try/catch within the big try/catch that would catch just the actual sending if there is an error
    Sub btnSendFeedback(ByVal sender As Object, ByVal e As System.EventArgs)
        Try
            'Create an instance of the MailMessage class
            Dim objMM As New MailMessage()
 
            'Set the properties - send the email to the person who filled out the
            'feedback form.
            objMM.To = "****@****.net"
            objMM.From = txtEmail.Text
 
            'If you want to CC this email to someone else, uncomment the line below
            objMM.Cc = "****@****.org"
 
            'If you want to BCC this email to someone else, uncomment the line below
            objMM.Bcc = "****@****.org"
 
            'Send the email in text format
            objMM.BodyFormat = MailFormat.Text
            '(to send HTML format, change MailFormat.Text to MailFormat.Html)
 
            'Set the priority - options are High, Low, and Normal
            objMM.Priority = MailPriority.Normal
 
            'Set the subject
            objMM.Subject = "test"
 
            'Set the body
            objMM.Body = "At " + DateTime.Now + " feedback was sent from an ASP.NET " & _
                         "Web page.  Below you will find the feedback message " & _
                         "send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
                         "---------------------------------------" & vbCrLf & vbCrLf & _
                Module_Selection.SelectedItem.Text & vbCrLf & vbCrLf & _
                RequestType.SelectedItem.Text & vbCrLf & vbCrLf & _
                Category_Selection.SelectedItem.Text & vbCrLf & vbCrLf & _
                txtMessage.Text & vbCrLf & vbCrLf & _
                "Contact Information: " & vbCrLf & vbCrLf & _
                txtEmail.Text & vbCrLf & vbCrLf & _
                Phone.Text & vbCrLf & vbCrLf
 
 
 
 
            'Specify to use the default Smtp Server
            SmtpMail.SmtpServer = ""
 
            'Now, to send the message, use the Send method of the SmtpMail class
            Try
                SmtpMail.Send(objMM)
            Catch ex As Exception
                Response.Write("Error sending: " & ex.Message.ToString())
            End Try
 
 
 
            panelSendEmail.Visible = False
            panelMailSent.Visible = True
 
        Catch ex As Exception
            Response.Write("Error in : " & ex.Message.ToString())
        End Try
 
    End Sub

Open in new window

ok I just cut and pasted the whole thing... and got the same error... I have put in a request from the system admin to alowe the change in the web.config

was the info file above helpful? I was try to get info but there was no phpinfo() for asp... it is an .aspx file
here is the file
ASP.Net-Info.txt
can you post a screenshot of the full error page that comes up?
sure can...
Untitled-2.png
Quick question while I'm waiting for the network admin to get back to me on the web.config file... Why would the file run and work for a while ... then just stop?   I don't understand that part... I'm thinking that may help solve this?? lol... fun times here :-)
>>I don't understand that part... I'm thinking that may help solve this??

Absolutely, I was trying to see if we can actually get to a real error message that might tell us what the problem is when it breaks.
The error screen you posted is ASP.Net's generic error page that comes up usually when something breaks with the application and not because of specific code.
And it's telling you to make sure that customErrors is off, not that it already is turned off.
...and...this is one of those times when whether it is turned off or on, you probably get it anyways because it is breaking at a level of the app or above...(hope that makes sense)

also have your net admin go through the error logs to see if anything relating to IIS or www is in there....
great... I will have him get me those logs... thank you
jeremyBass
I just thought I'd let you know... I'm STILL waiting for the sdmin to give me what I need... Hope you'll stick with me when the guy finaly get me the stuff or gets fired and I gain controll... lol...
thanks again...
Jeremy
:( still waiting...
No problem.
...I assume the problem is still occurring...how often?
not sure I asked this (I re-read the thread quickly and didn't see it)...but once it breaks, does it ever "come back" and start working again?
Yeah it's still happening...


>>>but once it breaks, does it ever "come back" and start working again?
Nope... and it only does it when it is run from inside the network... when I run it from a VPN connection to that network... it runs...  and works great... and repeatedly...  that is what is really confusing the crap out of me....
thanks for sticking with me... I think the guy as probably going to get canned as it has been a month now and he has not even call me back... thou his bosses have ;) lol....  have a great day...
jeremy
oh one more note... after I run it from the VPN connection and all seems well... when it is run from inside the network and it gets broken... then if I run it from the VPN it no longer works...

very odd to me...
ASKER CERTIFIED SOLUTION
Avatar of samtran0331
samtran0331
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hopefully... thanks for sticking with me...
Ok... got something.... I don't think these are the error log information we need but I'm not a great asp expert so lets see...


Event Type:       Warning

Event Source:    ASP.NET 2.0.50727.0

Event Category: Web Event

Event ID:           1309

Date:                10/31/2008

Time:                11:57:46 AM

User:                N/A

Computer:         KILO

Description:

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 10/31/2008 11:57:46 AM

Event time (UTC): 10/31/2008 6:57:46 PM

Event ID: 7cd681c0c0f34871aeb8322076e1dd7a

Event sequence: 50

Event occurrence: 9

Event detail code: 0

 

Application information:

    Application domain: /LM/W3SVC/1/Root/sjrmc-1-128699469782656250

    Trust level: Full

    Application Virtual Path: /sjrmc

    Application Path: c:\inetpub\wwwroot\sjrmc\

    Machine name: KILO

 

Process information:

    Process ID: 7368

    Process name: w3wp.exe

    Account name: NT AUTHORITY\NETWORK SERVICE

 

Exception information:

    Exception type: NullReferenceException

    Exception message: Object reference not set to an instance of an object.

 

Request information:

    Request URL: http://kilo.sjrmc.org/sjrmc/clindocfeedbackform.aspx 

    Request path: /sjrmc/clindocfeedbackform.aspx

    User host address: *.*.70.85

    User:  

    Is authenticated: False

    Authentication Type:  

    Thread account name: NT AUTHORITY\NETWORK SERVICE

 

Thread information:

    Thread ID: 1

    Thread account name: NT AUTHORITY\NETWORK SERVICE

    Is impersonating: False

    Stack trace:    at ASP.clindocfeedbackform_aspx.btnSendFeedback_Click(Object sender, EventArgs e)

   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)

   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


thanks again for the help
jeremyBass
I don't know if this would help solve this but here is the webconfig file...
web.config.txt
Were these the right files?
Did I lose you? :)
Been busy with my real job...

What you posted is helpful (although I can't give you a solution based on it)...but the underlying error is:
Object reference not set to an instance of an object.

And since your code is fairly simple, the only object that might fail is:
Dim objMM As New MailMessage()

And since this works in some situations and not others (meaning the object gets instantiated correctly in one scenario but not another)...my best guess would be some kind of permissions difference between your VPN and the intranet...
I don't know how much more troubleshooting I can do today...and as this question is a bit old...

I would suggest you create a new question...
Title it: "POINTER TO 500pts. Email problem"
In the body, put a link back to this question.
Make the question worth 20pts.

This will effectively get the issue back on the "new question list" and noticed by more experts.

Also, use the "Request Attention" feature...this will notify assigned Experts of your issue also...
thank you for the help... I will re ask the question...

one same question... why 20pt?

thanks again...
jeremy
Avatar of Gyanendra Singh
are you inside a proxy server or or trying to send mail from address / SMTP  which require authentication.

use this


MailMessage message = new MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text);
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(txtSMTPUser.Text, txtSMTPPass.Text);
emailClient.UseDefaultCredentials = false;
emailClient.Credentials = SMTPUserInfo;
emailClient.Send(message);
litStatus.Text = "Message Sent";


and VB.net

Dim Message As MailMessage = New MailMessage()
Dim Smtp As New SmtpClient()
Dim SmtpUser As New System.Net.NetworkCredential()
'-- Build Message
Message.From = New MailAddress("larryking@cnn.com", "Larry King")
Message.To.Add(New MailAddress("oprah@oprah.com", "Oprah"))
Message.IsBodyHtml = False
Message.Subject = "Come on My Show Soon"
Message.Body = "Please be a guest on my show. - Larry"
'-- Define Authenticated User
SmtpUser.UserName = "larryking"
SmtpUser.Password = "suspenders"
SmtpUser.Domain = "mail.cnn.com"
'-- Send Message
Smtp.UseDefaultCredentials = False
Smtp.Credentials = SmtpUser
Smtp.Host = "mail.cnn.com"
Smtp.DeliveryMethod = SmtpDeliveryMethod.Network
Smtp.Send(Message)
I will try that on Monday and get back with you... would this explain why it worked when I use running it throught a vpn verses from in the intranet where it didn't?  thank you for the help

Jeremy
I was just letting you know that I have again not recieved the information yet needed to try you way...

thanks for sticking with me...
ok ok... finaly i have errors... lol

here they are, i hope i didn't lose you...

(on file @ top)
Source Error:


Line 32:
Line 33:   'Set the body
Line 34:   objMM.Body = "At " + DateTime.Now + " feedback was sent from the Clinical Documentation Feedback Form" & _
Line 35:                ".  Below you will find the feedback message " & _
Line 36:                "send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
 

Source File: c:\inetpub\wwwroot\sjrmc\clindocfeedbackform.aspx    Line: 34

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.clindocfeedbackform_aspx.btnSendFeedback_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\sjrmc\clindocfeedbackform.aspx:34
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

 
I would like to award the points here but it's kinda on a roll here...

http://forums.asp.net/p/1348301/2746511.aspx#2746511

may you could read and finsih it off... :)
Thanks for the help... the key was getting the errors... poking in the dark did no good... it was that the server could not relay my email... but could on the intranet ones... could have poked all day and not knowen that... :) thanks again and sorry for the long wait...

Jeremy