Solved

Login pop-up troubles

Posted on 2013-11-22
5
352 Views
Last Modified: 2014-01-14
Hello,

I have been tasked with making sure our website login page runs through HTTPS.  How the site works is no matter what page you are on you can click the login link, a pop-up modal box opens front and center with login form (login.aspx).  Once you login that box goes away and the user is taken back to the page they were on as an authenticated user.  This process works just fine, until I throw HTTPS in the way.

What I did on the login.aspx.cs page_load event was added:
if (!Request.IsSecureConnection)
        {
            Response.Redirect(Request.Url.AbsoluteUri.Replace("http://", "https://"));
        }

This part seems to work fine, once the login pop-up comes up I know it's now in HTTPS and the login function works fine...however the login box doesn't go away any longer.  The form goes away but there is the background of login.aspx still sitting there.  Here is the code that seemingly is supposed to make that pop-up disappear (also i have screen capture attached):

Response.Write("<script>window.parent.$eSite('#divLoginIframe').modalHide();if(window.parent.location.toString().indexOf(\"activateuser.aspx\") >0){window.parent.location = '/default.aspx';}else{window.parent.location = window.parent.location;}</script>");

I'm pretty sure I know what the problem is, but I don't know how to fix it.  The very last else it's setting the parent location (which should be the original page that called up the login), however my code to redirect to HTTPS I believe is changing that value and it's just trying to call itself as the parent location thus causing that frame to stay up and not go back to the original page.  I don't want to hard-code a parent location because I would like it to return back to the page the customer was on.

Any ideas how I can make this work?  I'm not big into Javascript so I'm not sure if something like this is easy or not.

Thanks,
Joe
image.jpg
0
Comment
Question by:sglew
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39670801
why not always use HTTPS, so configure IIS to redirect the user starting with HTTP?
0
 

Author Comment

by:sglew
ID: 39674628
Hi,

That is definitely an option, but it seems to be overkill having the entire site running HTTPS 24x7x365.  Not really the solution I was looking for.

Thanks,
Joe
0
 
LVL 11

Accepted Solution

by:
azarc3 earned 400 total points
ID: 39687140
Have you checked to see if there are any javascript errors being thrown? I wonder if you're getting something like an "illegal cross domain request" error...
0
 

Author Comment

by:sglew
ID: 39706049
Thanks so much!  I will check that possibility.
0
 

Author Closing Comment

by:sglew
ID: 39779913
Hello,

Found it was a cross-domain issue, was able to get around it.

Thanks for the suggestion.

Joe
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question