How do I convert a URL in ASP.Net

Posted on 2009-07-13
Medium Priority
Last Modified: 2013-11-08
I'm trying to use Context.RewritePath in protected void Application_BeginRequest to rewrite a URL but without much luck.

I want to be able to take the URL


and convert this using a rewrite to


I've tried to use the code supplied but with no luck as I simply get told that my page cannot be found.  Any suggestions are welcomed
string fullOrigionalpath = Request.Url.ToString();
            if (fullOrigionalpath.Contains("/customer/"))
                string customer = fullOrigionalpath.Substring(fullOrigionalpath.LastIndexOf("/"));
                Context.RewritePath("/Login.aspx?customer=" + customer);

Open in new window

Question by:noel58
LVL 15

Expert Comment

ID: 24844591
LVL 23

Accepted Solution

Saqib Khan earned 2000 total points
ID: 24846530
I wrote a Tutorial for this.


However did you register your HTTP MODULE in web.config? if not then please Follow my above tutorial.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question