tailieunhanh - Professional ASP.NET 1.0 Special Edition- P27

Professional Special Edition- P27:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | End Try We can now save the personalization value s in the user s Session object so we can access them within the application pages without having to keep going back to the database. We also tell to create the authentication cookie and redirect the user back to the page they originally requested If blnIsAuthenticated Then save background color in Session object Session BGColor strBGColor . save other personalization settings here redirect user to original page strUsr Else b Invalid credentials b please re-enter. End If End Sub The Personalized Page Following a successful login the user is redirected to the page . In it we display their user name. We also include the same Log Off button - we won t be describing those features again here. What is different is the way that we set the background color of the page and display an appropriate set of hyperlinks depending on the current username. The opening body tag in the page includes a bgcolor attribute with the value set to a variable named strColor body bgcolor strColor This variable is declared in the script section of the page and so is globally available throughout the page script language VB runat server Dim strColor As String script We placed five ASP Hyperlink elements within the body of the page to create the HTML hyperlinks you can see in the screenshots above. The last three of these have their Visible property set to False so they won t normally be visible in the final page ASP Hyperlink id lnkUser1 Text Change Display Settings NavigateUrl http dummy runat server br ASP Hyperlink id lnkUser2 Text Change Sound Options NavigateUrl http dummy runat server br ASP Hyperlink id lnkAdmin1 Text Manage All Users Visible False NavigateUrl http dummy runat server br ASP Hyperlink id lnkAdmin2 Text Change Application Settings Visible False NavigateUrl http dummy runat server br ASP Hyperlink id lnkAdmin3 .

TỪ KHÓA LIÊN QUAN