Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2004, 04:26 PM
Authorized User
 
Join Date: Mar 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default siteprincipal

I am trying to only allow the the Default web page to be viewed by authenticated users. I also want to grab a few of the fields from the Users Details and cutomize the Default page:

I added to the Sub Page_Load
Code:
 If Not (TypeOf Context.User Is SitePrincipal) Then

                Response.Redirect("/ARSurvey/Webmodules/Accounts/Login.aspx")
            Else

                lblGreeting.Text = context.User.Identity.Name
            End If


If I use the check for context.user.identity.isauthenticated check then instead of my is siteprincipal check then I can view the page. The problem comes in when I attempt to pull user details using
Code:
  Dim currentUser As New AccBusiness.User( _
                      CType(Context.User, SitePrincipal))

I get a cast error.

What am I missing, why can I use the CType(context.user.... in the MyAccounts page but when I use it in Default I get a cast error.

I just do can not figure out what I am missing here.

 
Old March 30th, 2004, 06:13 AM
Authorized User
 
Join Date: Mar 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had type casting errors when i when i didnt have the code converting the current context into a siteprincipal object in the PhilePage.vb






Similar Threads
Thread Thread Starter Forum Replies Last Post
SitePrincipal JsonTerre1 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 29th, 2004 06:05 PM
(SitePrincipal)Context.User Philey BOOK: ASP.NET Website Programming Problem-Design-Solution 3 October 8th, 2004 05:38 PM
HTTPContext + SitePrincipal error (Wiggly Line) eureka BOOK: ASP.NET Website Programming Problem-Design-Solution 3 September 7th, 2004 09:15 PM
error :(SitePrincipal)Context.User yonghoo BOOK: ASP.NET Website Programming Problem-Design-Solution 5 August 5th, 2004 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.