Community discussion forum

Url Rewriting with Regex for ASP.NET 2.0

This is a comment thread discussing Url Rewriting with Regex for ASP.NET 2.0
  • 10 years ago

    This thread is for discussions of Url Rewriting with Regex for ASP.NET 2.0.

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 2 years ago

    Hi..

    Thanks for the tutorial..

    But, when one of my controls makes an postback event, the url changes ex:

    from:
    http://localhost:1310/Modeltypes/Login.aspx
    to:
    http://localhost:1310/Modeltypes/Default.aspx?ModuleName=Login

    And then the rewrite method sends moduleName=Default back, and sends the user to another page, "default"..

    Am i doing something wrong?

    sorry my poor english :), thanks in advance

    Jacob Jensen




















  • 2 years ago

    I figured out that removing the action attribute of the form fixed the problem:

    heres an example:
        public class Form : System.Web.UI.HtmlControls.HtmlForm
        {

            protected override void RenderAttributes(HtmlTextWriter writer)
            {

                writer.WriteAttribute(
                "name", this.Name);

                base.Attributes.Remove("name");

                writer.WriteAttribute(
                "method", this.Method);

                base.Attributes.Remove("method");

                this.Attributes.Render(writer);

                base.Attributes.Remove("action");

                if (base.ID != null)

                    writer.WriteAttribute(
                    "id", base.ClientID);

            }

        }

    But there is another bug, i cant seem to google out..

    My stylesheets and images isent shown, is there eny one who got the same problem? or is it something i am doing wrong ?



































  • 2 years ago

    Hello!

    I've tested the sample code but it doesn't work. When i run the code i get 404 - The resource cannot be found. Have I done anything wrong?



  • 2 years ago

    I have the same problem it is not seeing mine js files and css files have anyone found the solution for this

  • 1 year ago

    hi,
        I am using your example and am in a bit of a problem. the thing is I am getting redirected but if I am writing a url like so http://www.econn/page.aspx?id=10 & cat=20 how can i convert it to http://www.econn/page.aspx/id=10/cat=20 so that the parameters passed can be used on destination url

    Plz help me with this




  • 1 year ago

    ernestomodena wrote:
    I have the same problem it is not seeing mine js files and css files have anyone found the solution for this

    I hunted for two days to get this resolved...  Here it is:

    app.context.rewritepath(destinationurl, false);

    the false tells the application not to reset the virtual path - otherwise the new url becomes the new virtual path which in turn give ~/default.aspx another meaning

  • yesterday

Post a reply

Enter your message below

Sign in or Join us (it's free).