473,324 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

we have facing problem in asp.net ,actualy when i run program at localhost,it works ,

1
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



program:-
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Configuration;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Net.Security;
  10. using System.Net.Mail;
  11. using System.Net;
  12.  
  13. namespace WebDesign
  14. {
  15.     public partial class contact_us : System.Web.UI.Page
  16.     {
  17.         protected void Page_Load(object sender, EventArgs e)
  18.         {
  19.  
  20.         }
  21.  
  22.  
  23.         protected void SendMail()
  24.         {
  25.  
  26.             // any address where the email will be sending
  27.             var toAddress = YourEmail.Text.ToString();
  28.             // Gmail Address from where you send the mail
  29.             var fromAddress = "..fill..";
  30.             //Password of your gmail address
  31.             const string fromPassword = "..fill...";
  32.             // Passing the values and make a email formate to display
  33.             string subject = YourSubject.Text.ToString();
  34.             string body = "From: " + YourName.Text + "\n";
  35.             body += "Email: " + YourEmail.Text + "\n";
  36.             body += "Subject: " + YourSubject.Text + "\n";
  37.             body += "Question: \n" + Comments.Text + "\n";
  38.             // smtp settings
  39.             var smtp = new System.Net.Mail.SmtpClient();
  40.             {
  41.                 smtp.Host = "smtp.gmail.com";
  42.                 smtp.Port = 587;
  43.                 smtp.EnableSsl = true;
  44.                 smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
  45.                 smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
  46.                 smtp.Timeout = 20000;
  47.             }
  48.             // Passing values to smtp object
  49.             smtp.Send(toAddress, fromAddress, subject, body);
  50.         }
  51.  
  52.  
  53.         protected void btnSubmit_Click(object sender, EventArgs e)
  54.         {
  55.             try
  56.             {
  57.                 //here on button click what will done 
  58.                 SendMail();
  59.                 DisplayMessage.Text = "mail send";
  60.                 DisplayMessage.Visible = true;
  61.                 YourSubject.Text = "";
  62.                 YourEmail.Text = "";
  63.                 YourName.Text = "";
  64.                 Comments.Text = "";
  65.             }
  66.             catch (Exception) { }
  67.         }
  68.     }
  69. }
Apr 9 '14 #1
1 1101
Frinavale
9,735 Expert Mod 8TB
It would really help if you posted the stack trace details because an "unhandled exception" with no details or insight into which line of code is causing the problem makes it very difficult for anyone to help you solve your problem.
Apr 10 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Phil Galey | last post by:
VB.NET 2002 on Windows 2000 SP 3 When I start my program, the NotifyIcon appears in the tray, as it should. However, when I close the program, the NotifyIcon remains until I hover over it with...
29
by: keredil | last post by:
Hi, Will the memory allocated by malloc get released when program exits? I guess it will since when the program exits, the OS will free all the memory (global, stack, heap) used by this...
4
by: Ernesto | last post by:
I used Popen to launch a seperate telnet window, like this: subprocess.Popen("start telnet.exe -f C:\Folder\File.txt localhost 6000",shell=True) I is preferable to have this telnet window with...
2
by: Frel | last post by:
I had a look at the stantonfinley fedora core 5 instructions and robooted but to no avail. PHP scripts work fine from var/www/html whether the suffix is .php or .htm but not from localhost. I...
2
by: ForrestPhoto | last post by:
I would think it should disappear on its own when the application ends - if you have a main form and others, they'll all close when the user kills the main form. In any case, I override the...
7
by: cmdolcet69 | last post by:
Does anyone know how i could save a user textbox entery value and then when the program is shut down it would save that value for the next time so that it appears when the user start the program...
1
by: Shisou | last post by:
I think the title says it all... i'm building a program that will read in a dictionary and then ask the user for a string and will check all permutations of the string against the dictionary to see...
0
by: nishadmry | last post by:
Hi, I am getting the following Exception when I am loading DB2 Driver in my java program. Exception in thread "main" java.lang.UnsatisfiedLinkError: SQLAllocEnv at...
1
by: vehi | last post by:
For example I have a button and I would like to use it to turn something on and off with the same button. So I thougt, I would use some wariable which woild keep track of the state, but I can't seem...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.