views:

19

answers:

1

I have an asp.net website StartPage that does not require signing-in, in order to view it. On this StartPage, there is a Login linkbutton that when clicked opens a small Login popup page. Unfortunately, after the user has entered their loin credentials and clicks login, the destination page loads in the same popup window which is not my desired result.

What i would like is when the user has successfully been authenticated, the popup Login window should close and redirect the user to the destination page, but this destination page should load in the original main window.

This is the function that opens the popup windows

 function PopupCenter(pageURL, title, w, h) {
            var left = (screen.width / 2) - (w / 2);
            var top = (screen.height / 2) - (h / 2);
            var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
        }           

And the linkbutton OnClient property is like so

 <asp:LinkButton ID="LinkButton2" runat="server" 
    onclientclick="PopupCenter('Login.aspx', 'myPop1',400,300);">Log Me In</asp:LinkButton>
+2  A: 

This is impossible with this approach, I mean you should avoid using window.open. Instead you can create your custom pop-up (for example using divs). On this pop-up you will need to create same HTML elements as in your "Login.aspx" page and the same sever logic too. Than you will need to modify your PopupCenter function to open your custom pop-up instead of using window.open.

Restuta
FYI: The pop-ups you're describing are conventionally known as pop-overs or lightboxes. You're right though :)
annakata
Restuta - Do you have a good link that can get me started on "creating custom pop-ups using Divs) so i can look at how much work is required and decide if i should take route.
Name.IsNullOrEmpty
jqModal FTW. http://dev.iceburg.net/jquery/jqModal/
RPM1984
Agree with RPM1984
Restuta