Emailing the Contents of a Page
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:
Public Sub EmailPage()
Dim content As String
' execute a URL and receive the HTML content as a string
content = NetUtils.ExecuteUrl("http://www.ironspeed.com?id=1")
' 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
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.