Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 August 30th, 2006, 08:51 AM
Authorized User
 
Join Date: Mar 2004
Location: , , Norway.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default need to add a reference to System.Net.Mail

Hi,

In Chapter 3 (page 104) the code for the txtSubmit_Click() event is displayed. Marco uses a MailMessage class, which is included in the System.Net.Mail namespace.

I have added "using System.Net.Mail;" to the top of the file where the event is implemented, but it seems that it doesn't recognize the namespace. I tried adding a reference to it (menu: WebSite->Add reference), but System.Net.Mail isn't listed in the Dialog box (under the .NET tab). Is it just my system, or isn't System.Net registered by default?

In any case, does anyone know how I can add a reference to this namespace, or even make it appear in the Add reference dialog box? I have read somewhere on the net that I need to add registry keys if I want to make my home-made namespaces appear on the Add reference namespace list, but I don't know if this applies to me as well. After all, the System.Net.Mail namespace is a part of the System.dll file, which is referenced. I don't get it.

Could anyone nudge me in the right direction?

--------
Wisdom on the internet? How rare!
__________________
--------
Wisdom on the internet? How rare!
  #2 (permalink)  
Old August 31st, 2006, 04:02 AM
Authorized User
 
Join Date: Mar 2004
Location: , , Norway.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I solved this problem. However, I'm not entirely certain of what caused the problem to be fixed. I read a bit of the GAC (Global Assembly Cache), and thought maybe I had to re-register the System.dll assembly, since it seemed that some assemblies within it wasn't available from within the Add Reference dialog box in Visual Studio. I ran the following command from the Visual Studio command line:

gacutil -if [assemblyPath]

I restarted my PC, but I still couldn't add the reference. Wasn't on the list. I then tried to build the web site, and resolved a missing namespace (had to add "using System.Web.Configuration" to the file App_Code\Globals.cs). Then all of a sudden, IntelliSense displayed System.Net related assemblies, where it before had shown none.

I believe it was the gacutil assembly registration of the System.dll file that did the trick, but it seems that Visual Studio needed me to execute the "Build website" command before it noticed that System.dll had been re-registered. Well, at least, that is my theory. Anyway, problem is solved :)

I hope this will be able to help other people who may experience the same problem.

--------
Wisdom on the internet? How rare!
  #3 (permalink)  
Old August 31st, 2006, 10:34 AM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, I had this happen to. It self corrected after a while, so I don't know what the problem was. When I originally tried to enter the namespace I put it at the bottom of the list of declared namespaces, when it corrected, I was trying to put it somewhere in the middle by alphabetized order. I have no idea what caused it.

As far as sending the mail. I put the sendMail function in the helpers class, so that I can use it in other places in the website.

  #4 (permalink)  
Old January 9th, 2011, 04:17 PM
Registered User
 
Join Date: Jan 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem Sending Mail From Site with Localhost

Hi,
I am not able to send email from my local website - like "password recovery" system.
I am using windows prof 7 and here is my web.config file configuration:


<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="test@yahoo.com">
<network defaultCredentials="true" host="localhost" port="25"/>
</smtp>
</mailSettings>
</system.net>


Here is the Error after runing the page: PasswordRecovery.aspx

No connection could be made because the target machine actively refused it 127.0.0.1:25
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25

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.

Stack Trace:


[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:25]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
System.Net.ServicePoint.ConnectSocketInternal(Bool ean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224

[WebException: Unable to connect to the remote server]
System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +5482743
System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +202
System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +332
System.Net.Mail.SmtpConnection.GetConnection(Strin g host, Int32 port) +160
System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
System.Net.Mail.SmtpClient.GetConnection() +35
System.Net.Mail.SmtpClient.Send(MailMessage message) +1213

[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
System.Web.UI.WebControls.LoginUtil.SendPasswordMa il(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +367
System.Web.UI.WebControls.PasswordRecovery.Attempt SendPasswordQuestionView() +522
System.Web.UI.WebControls.PasswordRecovery.Attempt SendPassword() +69
System.Web.UI.WebControls.PasswordRecovery.OnBubbl eEvent(Object source, EventArgs e) +103
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +166
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


My SMTP and port 25 is installed and runing.

Has someome managed ton send email from localhost ??

Many thanks in advance.
 


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
System.Net.Mail Problem With Time Out When Sending Adam Thompson Visual Basic 2005 Basics 5 November 10th, 2012 05:24 AM
System.Net.Mail Problems With Sending An Email Doom C# 3 May 25th, 2008 02:49 PM
Send calendar invite using System.Net.Mail bbeau .NET Framework 2.0 0 November 20th, 2007 09:28 PM
embed images in email using system.net.mail Looney Classic ASP Basics 1 June 7th, 2005 05:11 PM



All times are GMT -4. The time now is 01:29 PM.


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