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 8177363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:29:22+00:00 2026-06-06T23:29:22+00:00

I am using: Response.Redirect(Request.RawUrl); to force a postback on my web page. However, the

  • 0

I am using:

Response.Redirect(Request.RawUrl);

to force a postback on my web page. However, the path of execution in the code is as if the page were loading for the first time. How do I cause just an ordinary postback?

Any advice is appreciated.

Regards.

EDIT:

This post seems to be attracting a lot of negativity. I got this method from a Stock Overflow post after a Google search for forcing a postback. So the downvoters should probably take out their frustrations on that post instead of mine.

To clear up some of the misapprehensions about my question:

I have an event Button_Click that contains logic in the method body — obviously. However the flow of execution of the code goes like this:

Button_Click –> Page_Load (IsPostBack == true) –> Button_Click body –> execution ends.

So my problem is that none of the logic in the body of Button_Click is showing up on the page because the postback is done before any of the code in the body of Button_Click is executed.

EDIT:

Here is the event:

protected void RedoEdits_Click(Object sender, EventArgs e)
{
    // Goes to Page_Load here with IsPostBack == true
    string trendsFileLocation = currDir + "\\" + reportDir + "\\" + trendsFile;
    string messagesFileLocation = currDir + "\\" + reportDir + "\\" + messagesFile;
    if (File.Exists(trendsFileLocation))
    {
        File.Delete(trendsFileLocation);
    }
    if (File.Exists(messagesFileLocation))
    {
        File.Delete(messagesFileLocation);
    }
    trendsXML.Clear();
    editMode = "redo";
}

Code snippet for IsPostBack == true:

if (editMode.Equals("redo"))
{
    editMode = "";
    ViewReport_Click(null, null);
}

The code snippet never gets exercised because the postback happens first, skips the snippet because editMode != redo, then finishes with the body of RedoEdits_Click which finally sets editMode == redo but since the postback has already happened we don’t get to ViewReport_Click.

And btw, editMode is a session variable so it persists.

  • 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-06T23:29:24+00:00Added an answer on June 6, 2026 at 11:29 pm

    I needed the page reload to restore my original, unedited, HTML. The process of editing the table replaced some InnerHTML and I needed to start over to redo the edits. So I just moved the logic necessary for redoing the edits in the code for IsPostBack != true and stayed with Response.Redirect(Request.RawUrl). Works like a charm.

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

Sidebar

Related Questions

I want to pass a few variables to another page. Currently I'm using response.redirect
I'm using MVC3 and in my view I have the following code block; Response.Redirect(@Url.Action(index,home,
I am redirecting from one page to another by using this command. Response.Redirect(~/Viewer/ViewerTest.aspx); Sometimes,
My android aplication tries to connect to a service using response = client.execute(getRequest); However
I'm trying to uncompress a GZIPed HTTP Response by using GZIPInputStream . However I
I want to redirect to another page using Server.Transfer and I have this simple
I am using the Response.Redirect method in a User Control to allow visitors to
We have a URLRewriting module that is using a Response.Redirect in the BeginRequest event
I'm trying to develop my first site in ASP.Net using Web Forms. I have
I am using this simple code to redirect http to https on my billing

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.