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 > BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 20th, 2007, 05:15 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!!
  #2 (permalink)  
Old August 20th, 2007, 08:11 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
  #3 (permalink)  
Old August 20th, 2007, 10:39 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.


  #4 (permalink)  
Old August 20th, 2007, 10:59 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
  #5 (permalink)  
Old August 22nd, 2007, 12:03 PM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


  #6 (permalink)  
Old August 22nd, 2007, 12:20 PM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
  #7 (permalink)  
Old August 26th, 2007, 01:05 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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("Temporary@gmail.com", 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 : Temporary@gmail.com
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 ="Temporary@gmail.com" port ="587" defaultCredentials ="false" />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>
Thanks.

Ajoy


  #8 (permalink)  
Old August 26th, 2007, 03:22 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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 <You@YourProvider.Com>" 
      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
  #9 (permalink)  
Old August 26th, 2007, 04:12 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #10 (permalink)  
Old August 26th, 2007, 04:23 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
 


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
Captcha + E-mail with link verification ViagraFalls BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 13 September 24th, 2007 04:06 AM
logo link in the header & strange chars - mail luisjeronimo BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 26th, 2007 11:07 AM
Send mail failed using asp.net anujrathi ASP.NET 1.0 and 1.1 Professional 1 June 22nd, 2006 07:59 PM
how to send activation link with e mail spbharti PHP How-To 2 December 28th, 2005 09:17 AM
e-mail a link p2ptolu Classic ASP Databases 1 June 17th, 2005 06:58 PM



All times are GMT -4. The time now is 09:58 AM.


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