1. Test



Database Overview. (The heart of any Pro Web Site…)

1 Drill down to Control Panel. Admin . Services and screen print the following (you may have only one of these two)

2 [pic]

3 This says an two instances of SQL Server

1 MSSQLServer is the default instance full installation.

2 SQLExpress is the free but very robust SQL server

Thoughts on using SQLExpress….

1 SQLExpress is very handy to have even if you are a power developer with full SQL Server

2 If using only SQLExpress (not a bad option) then…

1 Download and install the optional Management Studio

3 [pic]Drill down to Security . Logins . sa …right click

1 Status Tab: Enable

2 General: Uncheck Enforce Policy and change password to password or something you can remember

[pic]

4 At top of root… right click on server/database and select SQL & Windows Authentication mode

[pic]

5 Now you can use it just like regular SQL

.NET 2 membership tools require the aspnetdb.mdb

1 IF you have SQL Express then it can create the database the first time you open the Web admin tool security window.

1 Default if using basic SQL Express.

2 Option 2…you create it with the following line. Required IF not using SQLExpress

1 C:\WINDOWS\\Framework\v2.0.50727\aspnet_regsql.exe

Where does .NET look for this database?

1 Open C:\WINDOWS\\Framework\v2.0.50727\CONFIG\

2 machine.config and screen print the following line.

[pic]

1 This is the default. Use SQLExpress and (attach) a new instance aspnetdb in the app_data folder.

2 Possible to change this to point to a regular SQL server but you need a good reason to do this…

Membership in

1 Authentication: Who are you?

1 Login name and password is from a some “list”= credentials

1 Forms authentication: you manage the list = Internet

2 Windows authentication: Windows already has the list: Intranet

1 Default

2 Authorization: permissions

1 Once you are in… what you can do.

3 Default= Windows Authentication and Allow all Authorization.

4 Old days.

1 We had to create our own database and tools to capture and maintain credentials

2 ASP 2 has built that for us.

TIO Page 108

1 Extract Chapter04 into the Chapters folder…

1 Creates an empty Begin folder

2 Create the new blank website called Chapter04 (in the Begin folder)

3 [pic]

1 You have to type the Chapter04… say Yes to create it.

4 Follow instructions

5 Screen print the source view of the default page

6 [pic]

7 Create the login page as shown.

TIO Page 108-112: Easy just click and drag

1 Step7: When you click on “security link” in web site admin it builds the aspnetdb.mbd for the first time….. that is why you wait.

2 Walk through the Security Wizard as directed…

3 User passwords…. p@ssw0rd where 0 is a zero.

4 Create Login for User and Admin

5 Screen Print a successful Login

6 Screen Print a failure.

Behind the Scenes.

1 Right click on App_Data: Refresh

2 Right click on database: Open

3 Drill down to aspnet_users table… Show table data

4 Screen print the users you just added.

5 [pic]

6 Open the Web.config file and screen print the following. (note I have moved my tags around to get this screen print.

8 Screen Print the following

1 [pic]

10 This is how we did it in the old days…

1 Authentication Forms means use your own “list”

2 Authorization says… allow first two in but then everyone else deny.

TIO Page 122

1 Step one enables “non” logged on users into the site…but they will have a different “experience” than the logged on users.

2 Screen print the Default Source View.

3 [pic]

TIO Page 124

1 Create roles as described.

2 Modify rules as follows…

3 [pic]

4 Screen print the above screen

TIO Page 132: Not required

On your own.

1 Open Chapter04 you just created

2 Add subfolder called Administration

1 Add a SiteAdmin.aspx page with just one line

1 “Welcome “….loginname control.

2 Add a new item of type web configuration (web.config) to the sub folder

3 Using code on 135 modify so only the Administrators role is allowed

1 Tip… you can copy and paste part from the root web.config

3 PRINT the web.config you created.

4 Modify default page . Logged in template by adding a hyperlink to the new SiteAdmin.aspx page.

5 PRINT the following

1 Log in as Admin to prove you can get to the SiteAdmin page.

2 Log in as a user to prove you can’t get to the admin page

1 You end up back at the login page…. That is unkind…

2 We will fix that….

Rename the sub web.config in the Administration folder to web.confix.

1 web.confix will be ignored…

2 Add the following code to the page load of the site admin page.

3 [pic]

4 Add a new web page to the root called NoAccess.aspx

5 Add a single label and a loginstatus control.

6 Add the following code to page load

[pic]

7 Test to prove it works

8 Instead of getting bounced back to the login page they should get a friendly message on the NoAccessPage.aspx

9 Print all code and running Print of NoAccessPage

Extra Credit +3

1 Design a page that allows new users to “Create a Login” AND it adds them to the “Users” role

1 Note the role assignment is one line of code.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download