Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7420291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:12:44+00:00 2026-05-29T08:12:44+00:00

I have seemingly easy problem and am having trouble designing the right solution. I

  • 0

I have seemingly easy problem and am having trouble designing the right solution.

I have a normal asp .net login control. When the user logs in (and is successfully authenticated) I want to display a JavaScript message prompt like:

Warning: This is a government system…etc

There are a million and one ways to do this… but I really wanted to keep it inside my login user control. I played around with the following methods with no luck:

protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
    Page.ClientScript.RegisterStartupScript(this.GetType(), "warning", "alert('hello');", true);
}

protected void OnLoggingIn(object sender, LoginCancelEventArgs e)
{
    Page.ClientScript.RegisterStartupScript(this.GetType(), "warning", "alert('hello');", true); 
}

protected void OnLoggedIn(object sender, EventArgs e)
{
    Page.ClientScript.RegisterStartupScript(this.GetType(), "warning", "alert('hello');", true);
}

It seems like the postback page lifecycle is screwing me over.

Maybe I should think about this differently?

login page -> (success) -> warning message page -> user dashboard page

Any advice would be greatly appreciated.

Thanks!

-Josh

EDIT: I’ve also tried Page.ClientScript.RegisterClientScriptBlock(“….”);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:12:45+00:00Added an answer on May 29, 2026 at 8:12 am

    Are you using a master page/base page and session? you can do it this way so that the warning would be shown on the first non login page:

    protected void Page_load(object sender, EventArgs e) 
    {
       if (Request.IsAuthenticated && !Page.IsPostBack())     
          if (session["warningShown"] == null or session["warningShown"] == false)
          {
             session["warningShown"] = true;
             Page.ClientScript.RegisterStartupScript(this.GetType(), "warning", "alert('hello');", true); 
    
          }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Howdy, codeboys and codegirls! I have came across a simple problem with seemingly easy
I have a seemingly simple problem though i am unable to get my head
I have a seemingly simple problem whereby I wish to reconcile two lists so
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
I have been struggling with this seeminly easy problem for 48 hours, and I
I have a seemingly easy task of setting a radio button checked based on
While I have the problem itself seemingly resolved, I'm hoping someone can shed some
I have this seemingly easy issue in FF4. In the code below I need
I have been going crazy over a seemingly easy question with Python: I want
Good day once again. I have a (seemingly) simple problem. I'm trying to display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.