Clicky

Hi Experts

I've looked at the Business Application for silverlight 4 and i dont want to use the out of box login structure, is there a way i can create my own login page (even using a blank project) that will then load up main page after login successful?

Thanks

asked 09/08/2011 10:46

razza_b's gravatar image

razza_b ♦♦


8 Answers:
Under models: you can change the logininfo.cs, registrationdata.partial.cs, user.partial.cs to whatever you want,

you also have to change the views *.xaml  to match
link
ve3ofa's gravatar image

ve3ofa

Hi

ok i'll have a look, so would it be possible to load up a login page first, then when successful the mainpage can then load?

Thanks
link
razza_b's gravatar image

razza_b

also if using out of box login functionality could i modify it to query forms authentication against the DB? or windows authentication so that...

1. project opens up with login page
2. if successful main page will display user data functionality
3  if fails then no main page

at the moment i have taken the Business app and changed the design, i have two content areas on the mainpage - navigation section(populated by user roles queried on sp of username) on left and content section on right(child node selection opens up related page). Im not using the login at the moment.

or

with the design i have keep login container at top of mainpage so..

1  mainpage loads up with no mainpage functionality(nav & content sections blank), just login link section at top.
2. I login and if successful i want to populate navigation content based on username.(so i would need to store username after login to pass to sp to populate tree navigation)

Thanks
link
razza_b's gravatar image

razza_b

i have attached a screenshot of modified business app mainpage without using login and top section would contain login if it can work for me.

Tree would'nt be populated until successful login.

link
razza_b's gravatar image

razza_b

should work.. just a variable i.e. IsUserLoggedIn (true/false) If you are familiar with coding in MVC then this should be easy as it is basically the same
link
ve3ofa's gravatar image

ve3ofa

i'm not familiar with MVC at all, just trying to get used to silverlight.

so if i had everything hidden on mainpage i.e. tree nav and content and just had login at the top, could i store the username in app.xaml.cs if successful, then once logged in then pass usename to sp and show components for tree nav?

link
razza_b's gravatar image

razza_b

how would i set up forms auth to query my db using login structure?
link
razza_b's gravatar image

razza_b


The way I handle this is in the app.cs I add the following

       private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Load the main control
            Grid root = new Grid();
            root.Children.Add(new Page());
            this.RootVisual = root;
        }

This creates a new Grid which becomes the Root of the visual tree. You then add your login page to this.

Then once you have completed the login, just do the following

    public static void Navigate(UserControl newPage)
    {
        Grid root = Application.Current.RootVisual as Grid;
        UserControl oldPage = root.Children[0] as UserControl;

        root.Children.Insert(0, newPage);
        root.Children.Remove(oldPage);
    }
link
philsmicronet's gravatar image

philsmicronet

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 09/08/2011 10:46

Seen: 340 times

Last updated: 10/25/2011 12:15