Role based login in xamarin form

Vasanthakumar M 251 Reputation points
2021-05-31T17:33:25.777+00:00

Hi Xperts,
How to login role based in Xamarin forms.

For example :

username : Admin and password : Admin@123
We need to have set of menus like home ,change password, contact us, Register , Add , Delete and logout

Username : user1 and password : user@123
We need to have set of menus like home, change password , contact us and logout

For your info: I’m using sql server for Db , Storing roles in role table

How to work on this . Please guide me

Thanks in advance
VASANTH

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,378 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,966 Reputation points
    2021-06-01T01:33:05.263+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Role based login in xamarin form

    For this, please create multi application templates. Detect the role of the login accout to perform the navigation.

       if (accout.Role == "Admin")  
       {  
           MainPage = new NavigationPage(new Admin_Mainpage());  
       }  
       if (accout.Role == "User")  
       {  
           MainPage = new NavigationPage(new User_Mainpage());  
       }  
    

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.