Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 December 13th, 2010, 03:43 PM
Authorized User
Points: 322, Level: 6
Points: 322, Level: 6 Points: 322, Level: 6 Points: 322, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2010
Posts: 63
Thanks: 3
Thanked 0 Times in 0 Posts
Default Sending mail with CreateUserWizard

Hi Imar
I tried sending mail with the CreateUserWizard. My SMTP server needs authentication, which I declared in the web.config.

Here is the code (I removed the password):
<smtp deliveryMethod="Network">
<network host="mail.avidan.co.il" password="XXXXX" userName="myname@avidan.co.il" port="2525" defaultCredentials="true" />

It didn't work, I got an yellow error page (server needs authentication etc etc).

I added then the following code in the CreateUserWizard1_SendingMail prcoedure:

Dim mysmtpclient As SmtpClient = New SmtpClient("mail.avidan.co.il")
mysmtpclient.Port = "2525"
mysmtpclient.Credentials = New System.Net.NetworkCredential("myname@avidan.co.il" , "xxxxx")
e.Cancel = True

Now it's working! Why did I have to add the code in the CreateUserWizard1_SendingMail procedure? I thought putting the code in the web.config is enough.

Reply With Quote
  #2 (permalink)  
Old December 13th, 2010, 06:35 PM
Authorized User
Join Date: Oct 2009
Posts: 22
Thanks: 2
Thanked 10 Times in 7 Posts

The problem with your web.config configuration is the addition of this attribute:


This attribute makes the SmtpClient object use your windows credentials instead of the username and password that you provide to connect to the server. By default it is set to false, so you can either not include it in the network element OR set it to false.
Reply With Quote

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
error while sending mesage through CreateUserWizard control jack_hilary BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 September 25th, 2009 03:43 AM
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
sending mail anita VB How-To 3 September 30th, 2004 03:48 PM
Sending e-mail to different mail box! Calibus Classic ASP Databases 4 September 3rd, 2004 05:48 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM

All times are GMT -4. The time now is 01:04 AM.

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