Solved

How do I convert a URL in ASP.Net

Posted on 2009-07-13
2
199 Views
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

http://secure.myapp.com/customer/atlascs

and convert this using a rewrite to

http://secure.myapp.com/Login.aspx?customer=atlascs

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

0
Comment
Question by:noel58
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24844591
0
 
LVL 23

Accepted Solution

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

http://www.knowlegezone.com/documents/89/Simple-AspNet-Url-Rewriting-Tutorial-Http-Modules/


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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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