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

  • Home
  • SEARCH
  • 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 8386245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:52:58+00:00 2026-06-09T17:52:58+00:00

My code looks like: protected void Page_Load(object sender, EventArgs e) { if(IsPostback) { if(/*

  • 0

My code looks like:

protected void Page_Load(object sender, EventArgs e)
{
   if(IsPostback)
   {
      if(/* User is not authenticated to perform any actions on this page */)
      {
        Response.Redirect(/* Error Page */);
      }
   }
}

protected void btnSubmit_Click(object sender, EventArgs e)
{
   /* do some stuff */
}

I would have guessed that if I submit the button to do a postback and I was not authenticated, then in the Page_Load the redirect would happen and would send back an HTTP 302. However, it appears that it runs the Response.Redirect line of code, keeps processing past it in Page_Load, and then even runs btnSubmit_Click afterwards. The response is not the error page.

I can put a return call after the Response.Redirect to prevent further processing in that function, but the btnSubmit_Click function will still get run.

Why would it work this way?

  • 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-06-09T17:52:59+00:00Added an answer on June 9, 2026 at 5:52 pm

    To prevent more code from processing, use this:

    Response.Redirect(url, true);
    

    The second parameter will end further processing instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My code looks like below: private void LayoutRoot_Loaded(object sender, System.Windows.RoutedEventArgs e) { // TODO:
I have the following c# code in a web form: protected void GridView1_SelectedIndexChanged(object sender,
First here is my code: I have commented the problem lines protected void Page_Load(object
The basic pseudo code looks like this: void myFunction() { int size = 10;
Please take a look at this: protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int
Code looks like that #include <cstdlib> #include <iostream> using namespace std; #define n 3;
My code looks like <html> <head> <title>My HTML application</title> <HTA:APPLICATION id=frames border=thin caption=yes icon=http://www.google.com/favicon.ico
My code looks like follows var html = $(el).html().toString(); html = '2012-05-10'; var re
My code looks like this : Vector<String> My_Vector=new Vector<String>(); String My_Array[]=new String[100]; for (int
My code looks like this: NSIndexPath *ip = [NSIndexPath indexPathForRow:15 inSection:0]; [[self tableView] selectRowAtIndexPath:ip

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.