 |
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
 | This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

August 20th, 2007, 05:15 AM
|
|
Registered User
|
|
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Failed to get link in e-mail on signup
In ASP.NET2.0 Projects (InstantResults),(Wrox Publication) book authored by Spaanjaars, Wilton and Livermore, I am trying to run Appointment Booking System project (Project No.10) in IE. I have setup IIS, SMTP as per the book's instruction and trying to run it. As per the project if I am signing up as a new user, I should get an e-mail link in my email for authentication, but here only after clicking Sign Up I am getting Server Error "No connection could be made because the target machine actively refused it". But through Administrator login I can use the project.I am facing the same problem while running in vwd2005 environment. I am using Win XP. (Pl.Note : while I am following the procedure to change IIS setting and Changing Security settings, the "Userfile properties" window in Wrox CMS project (Project No.5), I am not finding "Security" Tab at all).I am new in ASP.NET field. Can any one please help me out!!
|
|

August 20th, 2007, 08:11 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
For the missing security tab, take a look here: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=286
It's also described in the book, but I don't know what page exactly.
Regarding the other error: this has to do with the way you're sending mail to the SMTP server. Apparently, your SMTP server that you configured in the web.config file doesn't allow you to send mail. Maybe you need to authenticate. If that's the case, add a username and password to the configuration (IntelliSense will tell you what and where exactly).
If that doesn't help, contact your ISP / mail hoster for more info about connecting to their system from an ASP.NET web application.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

August 20th, 2007, 10:39 AM
|
|
Registered User
|
|
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear Sir,
Thanks for the reply. The link you have provided, remarkebly solved my "Security Tab Missing" issue. I was actually overlooking NTFS issue and now I got the point exactly. Thanks. But regarding my "Failed to get link in e-mail on signup" problem, can you please take a little bit pain to explain in details what exactly I have to change in my web.config file and in which places to have it effected. I have understood the problem now and it must be my web.config file settings which is giving all the trouble to my efforts, as you have pointed out rightly. On this verge of solving the problem, please help me with your great experience and talent.
Thanks a lot for your reply again.
|
|

August 20th, 2007, 10:59 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
It's not that remarkable. I wrote the FAQ to solve exactly this problem.... ;)
With regards to web.config: you need to configure a mail server that will accept your outgoing mail. Usually, this is something like smtp.yourprovider.com.
Take a look at the web.config that comes with the application, It looks like this:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="smtp.yourprovider.com" port="25" />
</smtp>
</mailSettings>
</system.net>
</configuration>
Replace smtp.yourprovider.com with a valid SMTP server which you should get from your provider or network administrator. Tip: this is usually the same server you configure in your e-mail client.
If you need to pass user credentials, try this instead:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="smtp.yourprovider.com" port="25" userName="userName" password="password" />
</smtp>
</mailSettings>
</system.net>
</configuration>
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

August 22nd, 2007, 12:03 PM
|
|
Registered User
|
|
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Thanks for reply. I have tried my level best but with no effect. Tried with free SMTP server like gmail.com using their designated port 465 and 587 and with username and password as per their requirement but getting the following error :
Server Error in '/AppointmentBooking' Application.
--------------------------------------------------------------------------------
The operation has timed out.
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.Mail.SmtpException: The operation has timed out.
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:
[SmtpException: The operation has timed out.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +2128
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) +482
System.Web.UI.WebControls.CreateUserWizard.Attempt CreateUser() +641
System.Web.UI.WebControls.CreateUserWizard.OnNextB uttonClick(WizardNavigationEventArgs e) +200
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source, EventArgs e) +651
System.Web.UI.WebControls.CreateUserWizard.OnBubbl eEvent(Object source, EventArgs e) +158
System.Web.UI.WebControls.WizardChildTable.OnBubbl eEvent(Object source, EventArgs args) +39
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +107
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +178
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3839
After several attempt there is no effect. Tried through some other free SMTP server, but landed with similar type of error. If there is some other way to cope with the problem, please take pain to reply. Thanx in advance
~ Ajoy
|
|

August 22nd, 2007, 12:20 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I am not sure why I should "take pain to reply", but either way, I don't have an answer.
Maybe it's a firewall issue. maybe you have security software blocking SMTP traffic, maybe the SMTP mail server from Google cannot be used for this; I don't know.
Sorry.
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

August 26th, 2007, 01:05 AM
|
|
Registered User
|
|
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi there,
I just found out that if I add following highlighted codes in your book's code, it works nicely but instead of getting one link in the mail, I am getting two links and that should be in this context naturally. I could not achieve to get single mail with link for authentication using this code. I hope you will definitely have an answer for this. Actually I am unable to include in the fourth parameter of "send" method the link which will authenticate an user, like what you have done in your code.
Hope you have got my difficulty.
Here is what I have done in your code in Signup.aspx. vb file.
Partial Class SignUp
Inherits System.Web.UI.Page
Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail
Dim sc As New Net.Mail.SmtpClient()
sc.EnableSsl = True
sc.Send(" [email protected]", CreateUserWizard1.Email, "Hello" & CreateUserWizard1.UserName, "Your Request has been accepted")
e.Message.Body = e.Message.Body.Replace("##Id##", Membership.GetUser(CreateUserWizard1.UserName).Pro viderUserKey.ToString())
e.Message.Body = e.Message.Body.Replace("##UserName##", CreateUserWizard1.UserName)
Dim applicationFolder As String = Request.ServerVariables.Get("SCRIPT_NAME").Substri ng(0, Request.ServerVariables.Get("SCRIPT_NAME").LastInd exOf("/"))
e.Message.Body = e.Message.Body.Replace("##FullRootUrl##", Helpers.GetCurrentServerRoot & applicationFolder)
End Sub
Protected Sub CreateUserWizard1_ContinueButtonClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.ContinueButtonClick
Response.Redirect("~/")
End Sub
End Class
Pls. Note.
gmail is a free smtp server which requires authentication and enableSSL = true command. For this I had to do it in the way shown above. For your ready refernce, you can use my gmailID and Password for testing purpose. Here it is.
User Id : [email protected]
Password : temptestasp
Port ; 465/587
Ofcourse I had made defaultCredentials = False in web.config file like
<mailSettings>
<smtp deliveryMethod ="Network" >
<network host ="smtp.gmail.com" password ="temptestasp" userName =" [email protected]" port ="587" defaultCredentials ="false" />
</smtp>
</mailSettings>
</system.net>
</configuration>
Thanks.
Ajoy
|
|

August 26th, 2007, 03:22 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Ajoy,
Quote:
|
quote:Hope you have got my difficulty.
|
Actually, I don't.
I don't understand what you mean with:
Quote:
|
quote:I am getting two links and that should be in this context naturally
|
The original code in the book uses a text-based file for the message set up in the markup like this:
Code:
<MailDefinition BodyFileName="~/StaticFiles/OptInEmail.html"
From="Appointment Booking <[email protected]>"
IsBodyHtml="True" Subject="Please Confirm Your Account With
the Appointment Booking System">
</MailDefinition>
So if you're getting two links in the e-mail message, I would check that message file.
Otherwise, please describe the problem in more detail.
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

August 26th, 2007, 04:12 AM
|
|
Registered User
|
|
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
In your Signup.aspx. vb file, whatever you have codded under
Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail,
is not working for a free smtp server like gmail.com because they need enableSsl = True and user authentication. That is the reason why I added those red lines and got the things done. Since I am adding those three lines in SendingMail method, your code also getting executed at the same time and sending two links,ie; one for my sc.send() method where I am not able to send a link except some textual info to user and another is your beautifully codded link for perfect authentication of user which actually I want. I think I am still unable to explain what I want to convey. Please use my gmailID and password and you will come to know the rest.
I failed to incorporate your way of generatiing link for user authentication in sc.send() method. If it is possible to pass somehow in the fourth parameter of send()method (ie; message body), my problem will be solved. Confused ? Please try practically and you will come to know my difficulty.
Thanks
Ajoy
|
|

August 26th, 2007, 04:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Inside the SendingMail event handler, you can cancel the event like this:
e.Cancel = True
You can then set up your own message with this pseudo code:
1. Read in mail body using System.IO.File
2. Replace values in body using Replace
3. Create a new MailMessage object and assign To, From, Subject and Body properties
4. Send the MailMessage using the Send method of the SmtpClient.
This way, you can cancel the original message, and replace it with your own.
Look in Global.asax for some ideas about using the MailMessage class.
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|
 |