<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Lisa Wollin : ASP.NET</title><link>http://blogs.msdn.com/lisawoll/archive/tags/ASP.NET/default.aspx</link><description>Tags: ASP.NET</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Password Protecting Web Pages</title><link>http://blogs.msdn.com/lisawoll/archive/2005/06/24/432429.aspx</link><pubDate>Sat, 25 Jun 2005 01:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:432429</guid><dc:creator>lisawoll</dc:creator><slash:comments>27</slash:comments><comments>http://blogs.msdn.com/lisawoll/comments/432429.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lisawoll/commentrss.aspx?PostID=432429</wfw:commentRss><description>&lt;P&gt;John Jansen, one of the FrontPage testers, sent me these three different ways to password protect pages in FrontPage.&lt;/P&gt;
&lt;P&gt;&lt;A href="#gui"&gt;Using a FrontPage site template and ASP&lt;/A&gt;&lt;BR&gt;&lt;A href="#snippets"&gt;Using Code Snippets&lt;/A&gt;&lt;BR&gt;&lt;A href="#aspnet"&gt;Using ASP.NET&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A name=gui&gt;&lt;/A&gt;&lt;STRONG&gt;To password protect pages using a FrontPage site template and ASP&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Here are specific steps to password protect pages using features built into FrontPage:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;From the &lt;STRONG&gt;File&lt;/STRONG&gt; menu, click &lt;STRONG&gt;New&lt;/STRONG&gt;. 
&lt;LI&gt;From the &lt;STRONG&gt;Web Site&lt;/STRONG&gt; tab, select &lt;STRONG&gt;FrontPage Server Templates&lt;/STRONG&gt; from the first list, and then select &lt;STRONG&gt;Database Interface Wizard&lt;/STRONG&gt; from the second list. 
&lt;LI&gt;Type the location where you want to put your password protected page. This must be an Windows Web server running IIS. 
&lt;LI&gt;Click &lt;STRONG&gt;OK&lt;/STRONG&gt;. 
&lt;LI&gt;In the Wizard… 
&lt;OL&gt;
&lt;LI&gt;Click &lt;B&gt;Next&lt;/B&gt; to create an ASP solution. 
&lt;LI&gt;Click &lt;B&gt;Next&lt;/B&gt; to use the default name for the connection. 
&lt;LI&gt;Click &lt;B&gt;Next&lt;/B&gt; to use the default columns in the table. 
&lt;LI&gt;Click &lt;B&gt;Next&lt;/B&gt; after the DB is created. 
&lt;LI&gt;Click &lt;B&gt;Next&lt;/B&gt; to use the default table. 
&lt;LI&gt;Check the box to use a Database Editor. 
&lt;LI&gt;Click &lt;B&gt;Next&lt;/B&gt;. 
&lt;LI&gt;Choose a password and enter it. 
&lt;LI&gt;Click &lt;B&gt;Next&lt;/B&gt;. 
&lt;LI&gt;Click &lt;B&gt;Finish&lt;/B&gt;. &lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;After FrontPage finishes building the site, all of the necessary code for password protecting pages has been generated. In order to protect any new pages, simply put the following code:&lt;BR&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;!-- #include file=”login.asa” --&amp;gt;
&amp;lt;%
If Session(SiteId) &amp;lt;&amp;gt; true Then
Response.Redirect(“login.asp?requester=&amp;lt;!--insert page name here--&amp;gt;”)
End If
%&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;above the &lt;CODE&gt;&amp;lt;HTML&amp;gt;&lt;/CODE&gt; tag on any page and save as .asp. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;A name=snippets&gt;&lt;/A&gt;&lt;STRONG&gt;To password protect pages using Code Snippets&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Here are steps to create password protected pages using code snippets:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a new site in FrontPage. 
&lt;LI&gt;Create a new page and switch to Code view. 
&lt;LI&gt;Delete all the code in the new page. 
&lt;LI&gt;Paste the following code as a code snippet.&lt;PRE&gt;&amp;lt;%
Username="user"
Password="pass"
' if any of the variables do not match, create error message
if Request.Form("login") &amp;lt;&amp;gt; Username or Request.Form("password") &amp;lt;&amp;gt; Password then
    MsgErr = "&amp;lt;h3&amp;gt;Authorization Failed.&amp;lt;/h3&amp;gt;"
    Response.Write MsgErr
    ' if correct, set the session variable and proceed
Else
    Session("someStringValue") = true
    ' redirect
    If Len(Request("requester")) &amp;gt; 0 Then
        Response.Redirect (Request("requester"))
    Else
        Response.Redirect "protected.asp"
    End if
End if
%&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Results -- Login&amp;lt;/title&amp;gt;
    &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"&amp;gt;
    &amp;lt;meta name="GENERATOR" content="Microsoft FrontPage 6.0"&amp;gt;
    &amp;lt;meta name="ProgId" content="FrontPage.Editor.Document"&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body bgcolor="#FFFFFF"&amp;gt;
    &amp;lt;FORM ACTION="login.asp" METHOD="post"&amp;gt;
    &amp;lt;h3&amp;gt;Login&amp;lt;/h3&amp;gt;
        &amp;lt;TABLE BORDER=0&amp;gt; 
            &amp;lt;TR&amp;gt;
                &amp;lt;TD ALIGN="right"&amp;gt;User name:&amp;lt;/TD&amp;gt;
                &amp;lt;TD&amp;gt;&amp;lt;INPUT TYPE="text" NAME="login" size="10" VALUE=''/&amp;gt;&amp;lt;/TD&amp;gt;
            &amp;lt;/TR&amp;gt;
            &amp;lt;TR&amp;gt;
                &amp;lt;TD ALIGN="right"&amp;gt;Password:&amp;lt;/TD&amp;gt;
                &amp;lt;TD&amp;gt;&amp;lt;INPUT TYPE="password" NAME="password" size="10" VALUE=''/&amp;gt;&amp;lt;/TD&amp;gt;
            &amp;lt;/TR&amp;gt;
            &amp;lt;TR&amp;gt;
                &amp;lt;TD&amp;gt;&amp;lt;input TYPE="hidden" NAME="requester" VALUE="&amp;lt;%=Server.HtmlEncode(Request("requester"))%&amp;gt;"&amp;gt;&amp;lt;/TD&amp;gt;
                &amp;lt;TD&amp;gt;&amp;lt;/TD&amp;gt;
            &amp;lt;/TR&amp;gt;
            &amp;lt;TR&amp;gt;
                &amp;lt;TD align="left"&amp;gt;&amp;lt;INPUT TYPE="submit" VALUE="Login"/&amp;gt;&amp;lt;/TD&amp;gt;
                &amp;lt;TD&amp;gt;&amp;lt;/TD&amp;gt;
            &amp;lt;/TR&amp;gt;
        &amp;lt;/TABLE&amp;gt;
    &amp;lt;/FORM&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;
&lt;LI&gt;Save page as login.asp. 
&lt;LI&gt;Create a new page and switch to Code view (or do this with any page you want to protect with a password). 
&lt;LI&gt;Above the opening &amp;lt;html&amp;gt; tag, paste in the following snippet. &lt;PRE&gt;&lt;CODE&gt;&amp;lt;%
If Session("someStringValue") &amp;lt;&amp;gt; true Then
    Response.Redirect("Login.asp?requester=protected.asp")
End If
%&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;LI&gt;Save this page as protected.asp (or replace the requester text above from protected.asp to the page name you are protecting). 
&lt;LI&gt;Browse to protected.asp. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;A name=aspnet&gt;&lt;/A&gt;&lt;STRONG&gt;To password protect pages using ASP.NET&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Here are steps to password protect pages using ASP.NET:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a new page in your Web site and switch to code view. 
&lt;LI&gt;Select and delete all the code in the page. 
&lt;LI&gt;Paste in the following code. &lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Please Log In&amp;lt;/h1&amp;gt;
    &amp;lt;hr&amp;gt;
    &amp;lt;form runat="server"&amp;gt;
    &amp;lt;table cellpadding="8"&amp;gt;
        &amp;lt;tr&amp;gt;
            &amp;lt;td&amp;gt;User Name:&amp;lt;/td&amp;gt;
            &amp;lt;td&amp;gt;&amp;lt;asp:TextBox ID="UserName" RunAt="server" /&amp;gt;&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
        &amp;lt;tr&amp;gt;
            &amp;lt;td&amp;gt;Password:&amp;lt;/td&amp;gt;
            &amp;lt;td&amp;gt;&amp;lt;asp:TextBox ID="Password" TextMode="password" RunAt="server" /&amp;gt;&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
        &amp;lt;tr&amp;gt;
            &amp;lt;td&amp;gt;&amp;lt;asp:Button Text="Log In" OnClick="OnLogIn" RunAt="server" /&amp;gt;&amp;lt;/td&amp;gt;
            &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
    &amp;lt;/table&amp;gt;
    &amp;lt;/form&amp;gt;
    &amp;lt;hr&amp;gt;
    &amp;lt;h3&amp;gt;&amp;lt;asp:Label ID="Output" RunAt="server" /&amp;gt;&amp;lt;/h3&amp;gt;
    &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
    &amp;lt;script language="C#" runat="server"&amp;gt;
        void OnLogIn (Object sender, EventArgs e)
        {
            if (FormsAuthentication.Authenticate (UserName.Text, Password.Text))
                FormsAuthentication.RedirectFromLoginPage (UserName.Text, false);
            else
                Output.Text = "Invalid login";
        }
    &amp;lt;/script&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;LI&gt;Save the page as loginpage.aspx. 
&lt;LI&gt;Create a new page and switch to code view. 
&lt;LI&gt;Select and delete the code in the page. 
&lt;LI&gt;Paste the following code into the new page. &lt;PRE&gt;&lt;CODE&gt;&amp;lt;configuration&amp;gt;
    &amp;lt;system.web&amp;gt;
        &amp;lt;authentication mode="Forms"&amp;gt;
        &amp;lt;forms loginUrl="LoginPage.aspx"&amp;gt;
        &amp;lt;credentials passwordFormat="Clear"&amp;gt;
    &amp;lt;user name="Bruce" password="Batman"/&amp;gt;
    &amp;lt;/credentials&amp;gt;
    &amp;lt;/forms&amp;gt;
    &amp;lt;/authentication&amp;gt;
    &amp;lt;authorization&amp;gt;
    &amp;lt;deny users="?" /&amp;gt;
    &amp;lt;/authorization&amp;gt;
    &amp;lt;/system.web&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;LI&gt;Save the page as web.config. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;And that’s all there is to that. Any aspx pages in the same folder as the web.config file are protected.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=432429" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lisawoll/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category><category domain="http://blogs.msdn.com/lisawoll/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/lisawoll/archive/tags/Classic+ASP/default.aspx">Classic ASP</category></item><item><title>Working with ASP.NET Controls in FrontPage</title><link>http://blogs.msdn.com/lisawoll/archive/2004/06/18/159758.aspx</link><pubDate>Fri, 18 Jun 2004 23:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:159758</guid><dc:creator>lisawoll</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/lisawoll/comments/159758.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lisawoll/commentrss.aspx?PostID=159758</wfw:commentRss><description>&lt;P&gt;I wanted to post a quick note about an add-in that one of the FrontPage testers, Harris Chan, developed for working with ASP.NET controls in FrontPage. To be honest, I just installed it, so I haven't had a lot of time to work with it. If you're interested in downloading and installing the add-in, you can find it on the &lt;A href="http://www.microsoft.com/frontpage/downloads/addin/launchupdate/searchdetail.asp?a=535"&gt;FrontPage Add-in Center&lt;/A&gt;
&lt;P&gt;
&lt;P&gt;If you have any comments or questions, feel free to post them. I'll forward them onto Harris.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=159758" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lisawoll/archive/tags/FP+and+VS/default.aspx">FP and VS</category><category domain="http://blogs.msdn.com/lisawoll/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Deploying ASP.NET Applications</title><link>http://blogs.msdn.com/lisawoll/archive/2004/05/19/135478.aspx</link><pubDate>Thu, 20 May 2004 00:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:135478</guid><dc:creator>lisawoll</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/lisawoll/comments/135478.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lisawoll/commentrss.aspx?PostID=135478</wfw:commentRss><description>&lt;basefont face="verdana" size="2"&gt;
&lt;P&gt;We recently published an article in the MSDN FrontPage portal called
&lt;A href="http://weblogs.asp.net/lisawoll/archive/2004/04/29/123204.aspx"&gt;Using ASP.NET with FrontPage&lt;/a&gt;.&amp;nbsp; The article does well, but there's one complaint from a reader that the article doesn't address how to make an ASP.NET project run on a Web server.&amp;nbsp; 
I'm not sure the article should, but I remember having that same question with the first ASP.NET app I actually 
copied to a server.&amp;nbsp; It wouldn't run, and there were no clues as to what I needed to do to make it run.&amp;nbsp; 
I even tried creating a Web app directly on the server to see if that would 
help.&amp;nbsp; It didn't.&lt;/P&gt;
&lt;P&gt;I was certain it was a server problem and not a code problem, since I could 
run the application fine on my machine just not on the server.&amp;nbsp; The .NET 
Framework was, of course, installed and running. So I did some research and what 
I found was a help topic that said that ASP.NET deployment is as simple as 
copying the necessary files to the Web server.&amp;nbsp; Okay, I did that without 
success, so what was I missing?&lt;/P&gt;
&lt;P&gt;When I was in college, I had a writing instructor who used the term COIK 
writing:&amp;nbsp; Clear Only If Known.&amp;nbsp; Many technical writers mistakenly make 
assumptions about their readers.&amp;nbsp; Now I'm not saying that all assumptions 
are bad or wrong.&amp;nbsp; For example, as a programmer writer, I have to assume 
that my readers at least know what code is if they haven't actually written it 
before.&amp;nbsp; But there are just some assumptions that shouldn't be made.&lt;/P&gt;
&lt;P&gt;With the help for deploying ASP.NET applications, the assumption was that I 
understood what needed to be done on the server in order to make my Web app run, 
making the additional information unnecessary.&amp;nbsp; Perhaps I should have 
known; I've certainly worked with IIS, but (as I've said before) servers are not 
my thing.&amp;nbsp; In the past, I've preferred to leave them to others, but I've 
realized that if I want to provide server-side anything on my Web sites, I need 
to know as much as, if not more than, my Web server admins about what the server 
needs to do and how to do it.&lt;/P&gt;
&lt;P&gt;The help for deploying ASP.NET applications wasn't incorrect.&amp;nbsp; You can, 
in fact, copy ASP.NET files to the server using XCopy or an FTP program, 
provided you know which files you need to copy.&amp;nbsp; However, deploying a Web 
app is more than just copying the necessary files to the Web server.&amp;nbsp; So 
what else needs to be done?&lt;/P&gt;
&lt;P&gt;In the IIS &lt;b&gt;Properties&lt;/b&gt; pages for a Web site's virtual directory, there 
is a &lt;b&gt;Directory&lt;/b&gt; tab that contains the application settings.&amp;nbsp; By 
default, when an admin creates an IIS Web site (or virtual directory), the 
application name is empty or says &amp;quot;Default Application&amp;quot; in greyed text.&amp;nbsp; 
All you need to do is click &lt;b&gt;Create&lt;/b&gt; to tell IIS to run server-side code 
from the Web sites virtual directory.&lt;/P&gt;
&lt;P&gt;The folder into which you copy or FTP the files for an ASP.NET Web 
application may be a subfolder in your Web site but may not be a virtual 
directory in IIS.&amp;nbsp; In this case, your Web server admin needs to add it as a 
virtual directory in IIS.&amp;nbsp; Either way, the admin also needs to set the 
application settings for the virtual directory.&lt;/P&gt;
&lt;P&gt;Of course, this is a simplified version of what needs to be done, and I'm 
sure there are other settings that Web developers may need to know to 
effectively deploy ASP.NET applications, but every Web app that I created before 
knowing this, that previously didn't work, now functions as expected after 
clicking &lt;b&gt;Create&lt;/b&gt;.&amp;nbsp; Isn't it wonderful when things work?&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=135478" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lisawoll/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category><category domain="http://blogs.msdn.com/lisawoll/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>