Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I convert a URL in ASP.Net

Posted on 2009-07-13
2
Medium Priority
?
201 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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.
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 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