none
Sharepoint 2010 FBA login page RRS feed

  • Question

  • Hi,

    I want to redirect the default login page to different pages (or site collections) based on user credentials or E-mail address. The problem is that the coding of that page is in _forms folder in virtual directories i.e. default.aspx..I dont want to customize the default page ,just want to add some code so that based on user credentials the user is redirected to different pages.. OR suggest some visual studio way

    ________________________________________________

    Vipul Jain

    Tuesday, June 21, 2011 4:12 AM

Answers

  • You can very well implement this functionality on the default login page that you are talking about. If you cannot afford code-behind for defalt login page, you can implement the logic using asp.net server scripts (embeded code blocks)

    http://msdn.microsoft.com/en-us/library/ms178135.aspx


    Sundar Narasiman
    • Marked as answer by Emir Liu Monday, June 27, 2011 2:42 AM
    Tuesday, June 21, 2011 11:26 AM
  • The default login page is just a standard ASP:Login control, it has an event called something like "Authenticating" you can hook to from your solution.  The trick is you need to get access to the page when it's being loaded so you can subscribe to that event.

    There are ways to do that easily, but it would affect the whole farm.

     

    1.  Change the code behind for the default login page to a class in your assembly, then have your class inherit from the original login page class.

    or

    2.  Make a new solution, create a new ASPX page and copy the markup from the Original Login page, then change your code behind class to inherit from the original login page.   Then modify what you want, or just register for the Authenticating event in OnInit and add your addtional code.  Then go into Authentication Providers for the webapplication and change the login page to point to your new page.

     

    The problem with changing the default login page url though, is that it breaks the Multi Logon selector page (when you have multiple zones configured for one web application).  Ideally, what I do is make my own MultiLoginSelector, Then I make my own login page and have my custom multi login selector point to my custom login page.

     

    My only question is, how are you planning on redirecting users based on credentials when they haven't logged in yet to get their credentials.

     

    To figure out how, all you really have to do is look at the markup for the pages, then use Red Gates Reflector to look at the code of their code behinds to see how it all works.


    My Blog: http://www.thesug.org/Blogs/ryan_mann1/default.aspx Website: Under Construction
    • Marked as answer by Emir Liu Monday, June 27, 2011 2:42 AM
    Tuesday, June 21, 2011 1:16 PM
  • Hi Vipul Jain,

     

    Here is a thread which has a similar demand, please refer to it:

    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/60e5c43a-f4ca-4356-8b6b-e8958679fe6d

     

    Thanks,

    Porter Wang

    • Marked as answer by Emir Liu Monday, June 27, 2011 2:42 AM
    Wednesday, June 22, 2011 7:30 AM

All replies

  • Hi!

    Perhaps a http module will be able to solve the problem?

    For more information and examples, http://msdn.microsoft.com/en-us/library/aa719858(v=vs.71).aspx
    http://www.15seconds.com/issue/020417.htm

    Hope this helps.

     


    Sebastian | MCTS
    Tuesday, June 21, 2011 5:33 AM
  • hi,

    I dont want to use Visual Studio 2010.I am coding in the default.aspx page under the _forms folder of the claim based web application under virtual directory folder.There only how to achieve yhe functionality.

    As I am unable to write the code in that default.aspx page because it is giving me compile time errors.

    Tuesday, June 21, 2011 6:10 AM
  • What are the compile time errors?
    Sebastian | MCTS
    Tuesday, June 21, 2011 6:40 AM
  • You can very well implement this functionality on the default login page that you are talking about. If you cannot afford code-behind for defalt login page, you can implement the logic using asp.net server scripts (embeded code blocks)

    http://msdn.microsoft.com/en-us/library/ms178135.aspx


    Sundar Narasiman
    • Marked as answer by Emir Liu Monday, June 27, 2011 2:42 AM
    Tuesday, June 21, 2011 11:26 AM
  • The default login page is just a standard ASP:Login control, it has an event called something like "Authenticating" you can hook to from your solution.  The trick is you need to get access to the page when it's being loaded so you can subscribe to that event.

    There are ways to do that easily, but it would affect the whole farm.

     

    1.  Change the code behind for the default login page to a class in your assembly, then have your class inherit from the original login page class.

    or

    2.  Make a new solution, create a new ASPX page and copy the markup from the Original Login page, then change your code behind class to inherit from the original login page.   Then modify what you want, or just register for the Authenticating event in OnInit and add your addtional code.  Then go into Authentication Providers for the webapplication and change the login page to point to your new page.

     

    The problem with changing the default login page url though, is that it breaks the Multi Logon selector page (when you have multiple zones configured for one web application).  Ideally, what I do is make my own MultiLoginSelector, Then I make my own login page and have my custom multi login selector point to my custom login page.

     

    My only question is, how are you planning on redirecting users based on credentials when they haven't logged in yet to get their credentials.

     

    To figure out how, all you really have to do is look at the markup for the pages, then use Red Gates Reflector to look at the code of their code behinds to see how it all works.


    My Blog: http://www.thesug.org/Blogs/ryan_mann1/default.aspx Website: Under Construction
    • Marked as answer by Emir Liu Monday, June 27, 2011 2:42 AM
    Tuesday, June 21, 2011 1:16 PM
  • Hi Vipul Jain,

     

    Here is a thread which has a similar demand, please refer to it:

    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/60e5c43a-f4ca-4356-8b6b-e8958679fe6d

     

    Thanks,

    Porter Wang

    • Marked as answer by Emir Liu Monday, June 27, 2011 2:42 AM
    Wednesday, June 22, 2011 7:30 AM