Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How to redirect from log-in.aspx to users my site directly ?

  Asked By: Heriberto    Date: Sep 13    Category: Sharepoint    Views: 5615

How to redirect from log-in.aspx to users my site directly ? Means once
user enter his login credential (using FBA) in log in page (logi-
in.aspx), it should redirect to his my site i.e.
http://portal/personal/testuser rathar then root web site.



9 Answers Found

Answer #1    Answered By: Tyrell Nash     Answered On: Sep 13

Add "?Source=URL" to the end of the login.aspx URL

Answer #2    Answered By: Silvia Wilkinson     Answered On: Sep 13

my login  url is http://portal/_layouts/login.aspx

Lets say, my username is testuser, Once user enter  his credential
information and once it is valdiated it should redirect  to

Can you please exaplain me in detail, how can I do this?

Answer #3    Answered By: Candy Walter     Answered On: Sep 13

But how to add username with following format


Answer #4    Answered By: Leanne Rios     Answered On: Sep 13

If you edit the login.aspx page  in the Layouts folder and add a
DestinationPageUrl attribute to the login  control that should do it.

Answer #5    Answered By: Zachary Roberts     Answered On: Sep 13

I did like this in login.aspx as mentionedd below,
but it is still redirecting to root  default page. I also did IIS rest.

<asp:login id="login" FailureText="<%
$Resources:wss,login_pageFailureText%>" runat=server width="100%"

It seems I am doing something wrong.

Answer #6    Answered By: Maura Durham     Answered On: Sep 13

Can the user access http://portal/personal/testuser/default.aspx if they type it
in manually? Without some significant modifications FBA users  can't normally
access MySites because they aren't members of the NTAuthorityAuthenticated

Answer #7    Answered By: Jagat Pandit     Answered On: Sep 13

Yes, If FBA user type directly
http://portal/personal/testuser/default.aspx in browser they will get
login screen, and after entering their credentials it will be
redirected properly to their my site  pages.

Answer #8    Answered By: Jerod Carrillo     Answered On: Sep 13

OK, I went back and dug out a project from a couple years ago that I did this
on. The following will work as long as the destination is INSIDE the site
collection where you are logging in. Unfortunately, every MySite is its own
Site Collection with its own security settings. So even if you log  in to the
primary site  and redirect  to the personal site, the personal site will send you
back to a login  page so that you can authenticate for that site collection. I
didn't have a MySite setup for testing, but I did have two different Site
Collections. If I redirect with a Site Collection it works. But if I redirect
to a different Site Collection I get a login prompt. In other words. I don't
think there is any way that you can achieve what you are trying to do without
being re-prompted for login. I've included the code anyway so you can test it
for yourself.

1. Make a backup copy of login.aspx in the layouts directory of the 12

2. Add the following code to the login.aspx file just above the first
<asp:content ... tag

<script runat="server">
protected void login_LoggedIn(object sender, EventArgs e)
login.DestinationPageUrl =

3. Add the following attribute to the <asp:login... control.


Answer #9    Answered By: Hema Pasupuleti     Answered On: Sep 13

It works as per your instruction. I did minor changes as
mentioned below, so it is not hardcoded.

<script runat="server" >
protected void login_LoggedIn( object sender, EventArgs e)
= "../personal/"+login.UserName+"/default.aspx";

I also test another option by changing redirection url on IIS-Home
directory, but I think it is not secure, please advise.

However I noticed 1 strange problem if I used above script, not sure
how to handele this. Here is the problem

As I using ADAMmembership, so I have following test users


If I login  thru test1 and test2, it works correctly and url is like

But I logged is as test@..., it gives me error. I tested witout
script then it logged in properly and its url is

I think it is not validating username whenever it has @ or any
special character or it adammembership_test name is not validating.

I dont want to use "adammembership_" in url. Most of the my user will
login using their email address.