Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 5th, 2008, 10:42 AM
Authorized User
Join Date: Aug 2006
Location: delhi, delhi, India.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to KamalRaturi Send a message via Yahoo to KamalRaturi
Default mail send error :page cannot be displayed

hi ,

I am using this code for sending mail using localhost( and port 25.

 MailMessage Mail = new MailMessage();
        MailAddress ma = new MailAddress(txtFrom.Text, txtName.Text);
        Mail.From = ma;
        Mail.Subject = txtSubject.Text;
        Mail.Body = txtComment.Text;
            SmtpClient smtpMailObj = new SmtpClient();
            //eg:localhost, 192.168.0.x, replace with your server name
            smtpMailObj.Host = ConfigurationManager.AppSettings["SMTPServer"];
            //Response.Write("Your Message has been sent successfully");
        catch (Exception ex)
            //Response.Write("Message Delivery Fails");


But I get error "page cannot be displayed " when smtpMailObj.Send(Mail) executes. I have gone through almost all forums but couldnt find solution.

Help me on this topic please.

  #2 (permalink)  
Old May 5th, 2008, 10:48 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

Hi there.. are you doing something after this?? (maybe redirecting?)



================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
================================================== =========
I know that CVS was evil, and now i got the proof:
================================================== =========
  #3 (permalink)  
Old May 5th, 2008, 10:59 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Take a look at this:

catch (Exception ex)
//Response.Write("Message Delivery Fails");

What do you think this does?

It swallows any exception that your code might throw which means you can't tell for sure what went wrong. Either write out ex.Message to the browser, or temporarily remove the try/catch block so you can see the real exception.

Using code block like this is the best way to keep yourself in the dark, clueless of the root cause of the problem...

After you find out the error, reintroduce the catch block, but don't catch a generic Exception, but one or more of the specific exceptions that the Send method might throw....

Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send E-mail from .asp page LiDenning Classic ASP Professional 2 April 28th, 2006 05:42 PM
this page can not be displayed "error" p2ptolu Classic ASP Databases 12 July 8th, 2005 12:04 PM
Unwanted error page displayed patwadd Classic ASP Basics 2 February 8th, 2005 10:07 AM
Terrible error: The page cannot be displayed csun ASP.NET 1.0 and 1.1 Basics 2 November 9th, 2004 10:16 AM
Error Message: The page cannot be displayed BSkelding ASP.NET 1.0 and 1.1 Basics 2 April 23rd, 2004 11:27 AM

All times are GMT -4. The time now is 02:12 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.