473,322 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

HttpContext.RewritePath

I'd really appreciate it if someone would give me a"plain English"
explanation of HttpContext.RewritePath(). I read the MSDN documentation, but
still don't understand it.

According to MSDN:
.... assigns an internal rewrite path. RewritePath allows for the URL that is
requested to differ from the internal path to the resource.

What does this mean? When would it be useful to have the paths differ ?

Thanks.
Nov 18 '05 #1
5 2697
It is especially useful with HTTPHandlers.
You could have fancy user-specific URLs such as this:
http://www.mysite.com/GuadalaHarry

But this would really be redirected internally (using RewritePath) to a more
normal path such as:
http://www.mysite.com/userpage.aspx?user=GuadalaHarry

The user would get to use the nice URL and wouldn't ever have to know that
you've really structured pages on your server differently than it appears.
This also gives you the freedom to change your file/folder structure on your
server in the future without changing the URLs that your users are already
familiar with.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Guadala Harry" <gh****@aol.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
I'd really appreciate it if someone would give me a"plain English"
explanation of HttpContext.RewritePath(). I read the MSDN documentation, but still don't understand it.

According to MSDN:
... assigns an internal rewrite path. RewritePath allows for the URL that is requested to differ from the internal path to the resource.

What does this mean? When would it be useful to have the paths differ ?

Thanks.

Nov 18 '05 #2
Thanks for the quick response! Exactly what I was looking for.
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
It is especially useful with HTTPHandlers.
You could have fancy user-specific URLs such as this:
http://www.mysite.com/GuadalaHarry

But this would really be redirected internally (using RewritePath) to a more normal path such as:
http://www.mysite.com/userpage.aspx?user=GuadalaHarry

The user would get to use the nice URL and wouldn't ever have to know that
you've really structured pages on your server differently than it appears.
This also gives you the freedom to change your file/folder structure on your server in the future without changing the URLs that your users are already
familiar with.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Guadala Harry" <gh****@aol.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
I'd really appreciate it if someone would give me a"plain English"
explanation of HttpContext.RewritePath(). I read the MSDN documentation, but
still don't understand it.

According to MSDN:
... assigns an internal rewrite path. RewritePath allows for the URL

that is
requested to differ from the internal path to the resource.

What does this mean? When would it be useful to have the paths differ ?

Thanks.


Nov 18 '05 #3
This seems to be what I'm looking for too but I'm not sure where to use this

Where would you put a code that rewrites the path? In begin_request? Obviously the path has to be rewritten before the actual loading of a page begins, right

I would really appreciate a few lines of code just for example and where to put them for this to work

how to for example do what you wrote, when request URL is http://www.mysite.com/GuadalaHarry to have the application load http://www.mysite.com/userpage.aspx?user=GuadalaHarry instead

and is there any way for userpage.aspx to get the original request URL

----- Steve C. Orr [MVP, MCSD] wrote: ----

It is especially useful with HTTPHandlers
You could have fancy user-specific URLs such as this
http://www.mysite.com/GuadalaHarr

But this would really be redirected internally (using RewritePath) to a mor
normal path such as
http://www.mysite.com/userpage.aspx?user=GuadalaHarr

The user would get to use the nice URL and wouldn't ever have to know tha
you've really structured pages on your server differently than it appears
This also gives you the freedom to change your file/folder structure on you
server in the future without changing the URLs that your users are alread
familiar with

--
I hope this helps
Steve C. Orr, MCSD, MV
http://Steve.Orr.ne

"Guadala Harry" <gh****@aol.com> wrote in messag
news:uv**************@TK2MSFTNGP10.phx.gbl..
I'd really appreciate it if someone would give me a"plain English
explanation of HttpContext.RewritePath(). I read the MSDN documentation bu still don't understand it
According to MSDN ... assigns an internal rewrite path. RewritePath allows for the URL tha

i requested to differ from the internal path to the resource
What does this mean? When would it be useful to have the paths differ
Thanks

Nov 18 '05 #4
I saw an example of its use in a Page_Load event procedure (in a code-behind
module).

You can see it for yourself in the Community Starter Kit at
http://www.asp.net/Default.aspx?tabindex=9&tabid=47

HTH
"Adrijan Josic" <an*******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
This seems to be what I'm looking for too but I'm not sure where to use this.
Where would you put a code that rewrites the path? In begin_request? Obviously the path has to be rewritten before the actual loading of a page
begins, right?
I would really appreciate a few lines of code just for example and where to put them for this to work.
how to for example do what you wrote, when request URL is http://www.mysite.com/GuadalaHarry to have the application load
http://www.mysite.com/userpage.aspx?user=GuadalaHarry instead?
and is there any way for userpage.aspx to get the original request URL?

----- Steve C. Orr [MVP, MCSD] wrote: -----

It is especially useful with HTTPHandlers.
You could have fancy user-specific URLs such as this:
http://www.mysite.com/GuadalaHarry

But this would really be redirected internally (using RewritePath) to a more normal path such as:
http://www.mysite.com/userpage.aspx?user=GuadalaHarry

The user would get to use the nice URL and wouldn't ever have to know that you've really structured pages on your server differently than it appears. This also gives you the freedom to change your file/folder structure on your server in the future without changing the URLs that your users are already familiar with.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Guadala Harry" <gh****@aol.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
> I'd really appreciate it if someone would give me a"plain English"
> explanation of HttpContext.RewritePath(). I read the MSDN
documentation, but
> still don't understand it.
>> According to MSDN: > ... assigns an internal rewrite path. RewritePath allows for the

URL that is
> requested to differ from the internal path to the resource.
>> What does this mean? When would it be useful to have the paths differ ? >> Thanks.
>>

Nov 18 '05 #5
Correction to my last post:
The example I saw was in the Page_Init event handler (not Page_Load).

"Guadala Harry" <gh****@aol.com> wrote in message
news:ur****************@TK2MSFTNGP11.phx.gbl...
I saw an example of its use in a Page_Load event procedure (in a code-behind module).

You can see it for yourself in the Community Starter Kit at
http://www.asp.net/Default.aspx?tabindex=9&tabid=47

HTH
"Adrijan Josic" <an*******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
This seems to be what I'm looking for too but I'm not sure where to use this.

Where would you put a code that rewrites the path? In begin_request?

Obviously the path has to be rewritten before the actual loading of a page
begins, right?

I would really appreciate a few lines of code just for example and where

to put them for this to work.

how to for example do what you wrote, when request URL is

http://www.mysite.com/GuadalaHarry to have the application load
http://www.mysite.com/userpage.aspx?user=GuadalaHarry instead?

and is there any way for userpage.aspx to get the original request URL?

----- Steve C. Orr [MVP, MCSD] wrote: -----

It is especially useful with HTTPHandlers.
You could have fancy user-specific URLs such as this:
http://www.mysite.com/GuadalaHarry

But this would really be redirected internally (using RewritePath) to a more
normal path such as:
http://www.mysite.com/userpage.aspx?user=GuadalaHarry

The user would get to use the nice URL and wouldn't ever have to
know that
you've really structured pages on your server differently than it appears.
This also gives you the freedom to change your file/folder

structure on your
server in the future without changing the URLs that your users are

already
familiar with.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Guadala Harry" <gh****@aol.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
> I'd really appreciate it if someone would give me a"plain English" > explanation of HttpContext.RewritePath(). I read the MSDN

documentation,
but
> still don't understand it.
>> According to MSDN:
> ... assigns an internal rewrite path. RewritePath allows for the

URL that
is
> requested to differ from the internal path to the resource.
>> What does this mean? When would it be useful to have the paths

differ ? >> Thanks.
>>


Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Aurel | last post by:
Hello, why HttpContext.RewritePath("path") doesn't work in IHttpmodule.AcquireRequestState ?!? Thanks Aurel
8
by: Jiho Han | last post by:
Can someone explain in layman's term, what HttpContext.RewritePath does? SDK doc explanation is kind of scant. Does it only affect the request processing for the duration of the processing(meaning...
1
by: marcmiles | last post by:
It looks like postbacks cause a problem with HttpContext.RewritePath. I've read about the two solutions below, but the first one seems extensive, and the scond one seems too easy. I sent an email...
15
by: James Higgs | last post by:
For a long time, our product has had a "vanity URLs" feature where nice URLs are mapped to ASPX files in an IHttpModule implementation, using HttpContext.RewritePath(). This has worked beautifully...
3
by: asanford | last post by:
I want to create an ASP.NET web application that receives a form POST message, inspects the data, and reroutes the request to one of many different servers. I wrote an IHttpModule which...
0
by: cpnet | last post by:
I was playing around with Beta 2 of VS2005, .NET 2.0, and built an IHttpModule do allow me to have nice URL's in my web app. It was working great. I had a URL like: ...
0
by: Martin | last post by:
asp.net 2.0 I have implemented the url rewriting using httpcontext.rewrite path( newpath, setbase) which all works fine in IE, but testing with fiddler ( www.fiddlertool.com) when you test...
2
by: Steven Nagy | last post by:
Hi all, I have the following file: ~/cms/page.aspx Normally, if you hit a url like http://localhost/MyApp/cms/page.aspx?PageID=32 ... this would load content dynamically. No big deal, this is...
1
by: jbitz | last post by:
Hi, This has got me really baffled. This has got me really baffled. When I run Dim url As String = HttpContext.Current.Request.Url.AbsolutePath.ToLower from Application_beginRequest in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.