Displaying a message box and then redirecting

D

debbiedchang

Hi, I have a custom user login authentication page. There are times
when the login authentication succeeds, but before I redirect to the
home page, I want to display a popup with a warning message to tell the
user that their password is about to expire. I can't get the popup to
display AND the page to redirect (only one or the other).

I thought maybe setting the document.location would work, but it still
doesn't redirect to the specified page. This is my code right now:
~~~~~~~~~~~~~~~~~
FormsAuthentication.RedirectFromLoginPage("user name", false);

string strMsgBoxScript = "<script language='javascript'>alert("Warning
message"); document.location=xyz.aspx'</script>"

Page.RegisterStartupScript("MsgBoxScript", strMsgBoxScript);
~~~~~~~~~~~~~~~~~
I tried adding in a response.redirect("xyz.aspx") but that redirects
the page without displaying the popup.

This has been driving me crazy so I would be extremely grateful for any
insight!
 
M

Mike Brind

Hi, I have a custom user login authentication page. There are times
when the login authentication succeeds, but before I redirect to the
home page, I want to display a popup with a warning message to tell the
user that their password is about to expire. I can't get the popup to
display AND the page to redirect (only one or the other).

I thought maybe setting the document.location would work, but it still
doesn't redirect to the specified page. This is my code right now:
~~~~~~~~~~~~~~~~~
FormsAuthentication.RedirectFromLoginPage("user name", false);

string strMsgBoxScript = "<script language='javascript'>alert("Warning
message"); document.location=xyz.aspx'</script>"

Page.RegisterStartupScript("MsgBoxScript", strMsgBoxScript);
~~~~~~~~~~~~~~~~~
I tried adding in a response.redirect("xyz.aspx") but that redirects
the page without displaying the popup.

This has been driving me crazy so I would be extremely grateful for any
insight!

This group covers classic ASP which is totally different to ASP.NET. Try
microsoft.public.dotnet.framework.aspnet.
 
S

Slim

Why don't you use some client code in the popup to redirect the page.

windows.opener.document.location = url
 
F

Firas S Assaad

Hey Slim are you sure this is the right code?
well if not try this:

<input type=button name=login value="Login"
onclick=javascript:TheFuncClick();>

<script language=javascript>
function TheFuncClick
{
alert("Dear user, Your password is about to expire!");
window.location.href="login.asp"
}
</script>


Hope this helps



Best Regards
Firas S Assaad
 
E

Evertjan.

Firas S Assaad wrote on 14 nov 2006 in
microsoft.public.inetserver.asp.general:
<input type=button name=login value="Login"
onclick=javascript:TheFuncClick();>

<input type=button name='login' value='Login'
onclick='TheFuncClick();'>

The javascript: part is not necessary.
 
S

Slim

Firas S Assaad said:
Hey Slim are you sure this is the right code?
well if not try this:

<input type=button name=login value="Login"
onclick=javascript:TheFuncClick();>

<script language=javascript>
function TheFuncClick
{
alert("Dear user, Your password is about to expire!");
window.location.href="login.asp"
}
</script>


Hope this helps


I believe he wants to display some html not just a alert, but if not your
idea would do just fine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,052
Latest member
KetoBeez

Latest Threads

Top