How can i block access to all silverlight pages if user is not logged in, without writing verification code in each page?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
All views can have multiple states added (e.g. simple buttons have lots of states).
Add 2 states to your outer shell view. e.g. A LoggedIn state and a LoggedOut state.
content view (as a child control)
login control.
Then use the VisualStateManager to switch between states based on the login state changes. An added bonus with this technique is you can author your own transitions from one state to the other (I strongly recommend using Expression Blend for this type of work).
This way they cannot get at anything and, as a bonus, you can login/logout from anywhere in your app and not lose your place 🙂
If you are using an MVVM model, you can use an attached property to control the state changes.
If you need specific help, or example, just ask.