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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:10:20+00:00 2026-06-03T13:10:20+00:00

I’ve been having an issue with URL Rewriting and Postbacks. Edit: Currently using IIS

  • 0

I’ve been having an issue with URL Rewriting and Postbacks.

Edit: Currently using IIS 7 and the URL Rewrite module.

Basically after a Postback, my URL Rewriting completely messes up and added some duplicated and unnecessary field value pairs to my query string. Considering I was parsing the URL in my code, this broke an already working page after a Postback is raised.

From what I saw many people before me had the same issue and pretty much all of them have fixed it with modifying the Form Action on PageLoad, like so:

protected void Page_Load(object sender, EventArgs e)
    {
        form1.Action = Request.RawUrl;

        //Some other interesting things.
    }

Important: This did the trick, it works.

However, although my developing experience is literally less than a month, I’ve been trying so far to look for more elegant solutions to my problems. I’ve been hinted that there might be a better alternative that involves editing the Global.asax in order to have the same results on a more “global” level.

This should, in my opinion, make it more efficient overall as the trick will be done before any other page is called.

So my actual question is:

How can I achieve the same by editing the Global.asax file instead of modifying the Form Action on my MasterPage loading event? If you have an even more elegant solution I would appreciate that you include it as well.

Considering this is my first question, I hope I’ve been constructive enough.

  • 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-03T13:10:22+00:00Added an answer on June 3, 2026 at 1:10 pm

    If you are unable to change the rewrite method then I can think of two approaches which may be better than what you have.

    1) Create a base page and rewrite the action in it – all pages should then inherit from the new base page. This keeps the code in one place and you do not have to write in every page.

    2) Inherit from the default form control and stop it rendering the action property altogether, it will then postback to the rewritten URL instead. Then replace all your form instances with your new control. You can see what I mean about half way down this article http://msdn.microsoft.com/library/ms972974

    Edit

    3) Scott Gu posted a solution to this problem (in this article http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx) which is much cleaner and does not involve changing any code by using Control Adapters.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.