<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Security</title><link>http://forums.asp.net/25.aspx</link><description>All about ASP.NET security (authentication, authorization, membership, roles, etc.) and the Login controls. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=24&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: forms authentication - email current page as html</title><link>http://forums.asp.net/thread/2368133.aspx</link><pubDate>Tue, 20 May 2008 09:41:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2368133</guid><dc:creator>DoaX</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2368133.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2368133</wfw:commentRss><description>&lt;p&gt;I have the same problem ...&lt;br /&gt;&lt;br /&gt;This doesn&amp;#39;t work:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="coloredcode"&gt;WebRequest wreq = System.Net.HttpWebRequest.Create(Request.Url.OriginalString);
wreq.Credentials = CredentialCache.DefaultCredentials;
WebResponse wrsp = wreq.GetResponse();

StreamReader sr = &lt;span class="kwd"&gt;new&lt;/span&gt; StreamReader(wrsp.GetResponseStream());
&lt;span class="kwd"&gt;string&lt;/span&gt; strHTML = sr.ReadToEnd();
sr.Close();&lt;/pre&gt;&amp;nbsp;&amp;nbsp;</description></item><item><title>Re: forms authentication - email current page as html</title><link>http://forums.asp.net/thread/1573809.aspx</link><pubDate>Sun, 11 Feb 2007 18:35:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1573809</guid><dc:creator>briancollins</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1573809.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1573809</wfw:commentRss><description>&lt;p&gt;i added the credentials directly under my declaration of objRequest as such:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Private Function ScreenScrapeHtml(ByVal url As String) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(url)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objRequest.Credentials = CredentialCache.DefaultCredentials&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'tbEmployee.Text = objRequest.Credentials&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim sr As New StreamReader(objRequest.GetResponse().GetResponseStream())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim result As String = sr.ReadToEnd()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'sr.Close()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return result&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function 'ScreenScrapeHtml&lt;/p&gt;
&lt;p&gt;this still returns the login screen instead of the active page content.&amp;nbsp; ideas?&amp;nbsp; I tried using your output referred to in the west-wind.com post, but wasn't successful there either, probably in the conversion from C# to VB.&lt;/p&gt;</description></item><item><title>Re: forms authentication - email current page as html</title><link>http://forums.asp.net/thread/1573133.aspx</link><pubDate>Sat, 10 Feb 2007 17:34:38 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1573133</guid><dc:creator>webdevl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1573133.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1573133</wfw:commentRss><description>&lt;p&gt;you are correct about the credetials being dropped.&amp;nbsp; The reason is that the server is making the request and not the client and the client is what has the credentials.&amp;nbsp; A couple suggestions are &lt;/p&gt;
&lt;p&gt;1.&amp;nbsp; Add the credentials to the request by adding &lt;font size=2&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;objRequest.Credentials = CredentialCache.DefaultCredentials&lt;/p&gt;
&lt;p&gt;which will pass the current credentials of the client to the request.&lt;/p&gt;
&lt;p&gt;or &lt;/p&gt;
&lt;p&gt;us this method to capture the output of the page &lt;a href="http://west-wind.com/weblog/posts/481.aspx"&gt;http://west-wind.com/weblog/posts/481.aspx&lt;/a&gt;&amp;nbsp;by overriding the render of the page.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please repost if you need more information.&amp;nbsp; If this solves your problem please mark as an answer to close the post.&lt;/p&gt;</description></item><item><title>Re: forms authentication - email current page as html</title><link>http://forums.asp.net/thread/1572568.aspx</link><pubDate>Sat, 10 Feb 2007 00:59:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1572568</guid><dc:creator>briancollins</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1572568.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1572568</wfw:commentRss><description>&lt;p&gt;Here's the function to obtain the page and then send it as an html email:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Private Function ScreenScrapeHtml(ByVal url As String) As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(url)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim sr As New StreamReader(objRequest.GetResponse().GetResponseStream())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim result As String = sr.ReadToEnd()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.Close()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return result&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function 'ScreenScrapeHtml&lt;br /&gt;-------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim message As _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New System.Net.Mail.MailMessage("&lt;a href="mailto:from@email.com"&gt;from@email.com&lt;/a&gt;", "&lt;a href="mailto:to@email.com"&gt;to@email.com&lt;/a&gt;")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message.Subject = "ECI Time Sheet - " + tbEmployee.Text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'screen scrape the html&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim html As String = ScreenScrapeHtml("&lt;a href="https://url.of.pageiwanttosend.aspx/"&gt;https://url.of.pageiwanttosend.aspx&lt;/a&gt;")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message.Body = html&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message.IsBodyHtml = True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim smtp As New System.Net.Mail.SmtpClient("192.168.x.x")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; smtp.Send(message)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br /&gt;End Class&lt;/p&gt;</description></item><item><title>Re: forms authentication - email current page as html</title><link>http://forums.asp.net/thread/1572492.aspx</link><pubDate>Fri, 09 Feb 2007 23:09:43 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1572492</guid><dc:creator>webdevl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1572492.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1572492</wfw:commentRss><description>What is happening on the button click (aka how are you generating the page into html to send)?&amp;nbsp; Post a code snippet if possible</description></item><item><title>forms authentication - email current page as html</title><link>http://forums.asp.net/thread/1571022.aspx</link><pubDate>Fri, 09 Feb 2007 05:05:07 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1571022</guid><dc:creator>briancollins</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1571022.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1571022</wfw:commentRss><description>&lt;p&gt;I am trying to send the contents of the page my users are currently logged into (i.e. "timesheet.aspx") as an email with the page shown in the body as html.&amp;nbsp; My users access the page using Forms Authentication via an LDAP/Active Directory connection string and login control.&amp;nbsp; My web.config seems to be configured correctly.&amp;nbsp; When the users submit the page via a button click event, the email that is sent contains the html from the login screen (login.aspx).&amp;nbsp; &lt;/p&gt;
&lt;p&gt;I'm assuming that somehow the user authentication isn't persistent when attempting to send the contents of the current page as an html email and the site is redirecting to the login screen.&amp;nbsp; Any suggestions?&lt;/p&gt;
&lt;p&gt;Please advise...&amp;nbsp; &lt;/p&gt;</description></item></channel></rss>