Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Monday, 02 April 2012

How to do this elegantly?

image

Could use the AspNetMembershipProvider.  Just  need to put in a MembersOnly.aspx page into account and it all works.

image

However this is complex.  I only want a single username and password to to get to the MembersOnly page and no backend db.  Ideally I’d also like this to be testable too.

Publish to Amazon EC2

Simplest thing is to publish my website in VS2010 to my filesystem, then copy paste the files up to EC2 using remote desktop.

Had to set the default app pool to .NET4 (advanced settings in IIS Manager)

image

and to set write permissions on a newly created App_Data folder for

image

SQL Express problems on the server

Changed web.config on the server to point to IP-0AEB5367 instead of .\SQLEXPRESS

image

Changed http://support.microsoft.com/kb/2002980   application pool identity to network service.

OnAuthenticate

http://www.netomatix.com/development/logincontrolbasic.aspx

public partial class Login : System.Web.UI.Page
    {
        //wired up from the control
        protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
        {
            if ((LoginUser.UserName == "dave") && (LoginUser.Password == "letmein"))
                e.Authenticated = true;
            else
                e.Authenticated = false;
        }

        //so if a user links to Secure/Page3.aspx they are redirected to Page2.aspx on successful login
        protected void OnLoggedIn(object sender, EventArgs e)
        {
            Response.Redirect("~/Secure/Page2.aspx");
        }
    }

and on the login control:

onauthenticate="OnAuthenticate" OnLoggedIn="OnLoggedIn"
| | #