Emailing the Contents of a Page

Updated January 12, 2010
Iron Speed Designer V6.2.1 and later

If you want to email the contents of a page to a user, you will need to execute the URL, receive the response from the server and email this response.  To do this, you can use a utility function provided in your application classes to execute the URL and receive its response.  Here is an example of how you can do it.

Visual Basic .NET:

Imports BaseClasses.Utils


Public Sub EmailPage()

     Dim content As String


          ' execute a URL and receive the HTML content as a string

          content = NetUtils.ExecuteUrl("")


          ' compose a message with this content.

          Dim email As New BaseClasses.Utils.MailSender



          email.SetSubject("This is the subject")




          'Send the email


     Catch ex As Exception

           ' handle error situations here

     End Try

End Sub

Application security

The ExecuteUrl function creates a new WebRequest for the URL and calls the WebResponse function get the page content.  However, your application maintains the login ID and roles in the application’s session and the new WebRequest has its own (empty) session.  When WebResponse is called, the page being read calls the Authorize method and attempts to authenticate the user.  From this page's point of view, no one is logged in (session is empty) so the application security layer will try to automatically sign in the user.  Otherwise, the user will be redirected to the Sign In page.

The Windows Authentication and Active Directory Authentication both have an automatic sign in feature; however, Database authentication security does not.

See Also

Sending Email from an Application