Home All Groups Group Topic Archive Search About
Author
16 Nov 2006 9:52 PM
Christina
Hiya!!

I am trying to do something really simple here..

I have a link, clicking on which leads to a page say MyPage.aspx.
There's a query string also passed to it. Hence its :

http://machineName/projName/MyPage.aspx?myQueryStr=abcd

Now, I dont want this to be displayed to the user. I want something
like:
http://machineName/projName/MyPage,
on anything, but NOT the querystring.

I tried the below code :

1)
In global.asax.vb :

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
         Dim strCurrentPath As String
         Dim strCustomPath As String

        strCurrentPath = Request.Path
        strCurrentPath = strCurrentPath.ToLower()
        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then

            strCustomPath = "http://machineName/projName/MyPage"

            Context.RewritePath(strCustomPath)
        End If

The above code gives an error : Invalid file name for monitoring..

2)
In page_load of mypage.aspx
        Context.RewritePath(strCustomPath)

Still the same error :-(

Any pointers ?

Thanks!!

Author
16 Nov 2006 10:42 PM
Mark Fitzpatrick
ASP.Net 2.0 has this built right in. What you'll want is the urlmapping
section of the config file (if I remember correctly). There's also a really
nice utility at http://www.urlrewriting.net that can do more extensive
mapping with regular expressions.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

Show quoteHide quote
"Christina" <chrisgir***@gmail.com> wrote in message
news:1163713938.460440.53870@i42g2000cwa.googlegroups.com...
> Hiya!!
>
> I am trying to do something really simple here..
>
> I have a link, clicking on which leads to a page say MyPage.aspx.
> There's a query string also passed to it. Hence its :
>
> http://machineName/projName/MyPage.aspx?myQueryStr=abcd
>
> Now, I dont want this to be displayed to the user. I want something
> like:
> http://machineName/projName/MyPage,
> on anything, but NOT the querystring.
>
> I tried the below code :
>
> 1)
> In global.asax.vb :
>
> Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> EventArgs)
>         Dim strCurrentPath As String
>         Dim strCustomPath As String
>
>        strCurrentPath = Request.Path
>        strCurrentPath = strCurrentPath.ToLower()
>        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then
>
>            strCustomPath = "http://machineName/projName/MyPage"
>
>            Context.RewritePath(strCustomPath)
>        End If
>
> The above code gives an error : Invalid file name for monitoring..
>
> 2)
> In page_load of mypage.aspx
>        Context.RewritePath(strCustomPath)
>
> Still the same error :-(
>
> Any pointers ?
>
> Thanks!!
>
Author
17 Nov 2006 3:04 AM
kferron
I don't think this is what she is asking, although urlmapping would
work for say, http://machineName/projName/MyPage.aspx (if you want
asp.net to handle files with no extension, this is a webserver setting
that has to handle the request first), you could map:


http://machineName/projName/MyPage.aspx

to

http://machineName/projName/MyPage.aspx?myQueryStr=abcd

you could not say, have MyPage.aspx also map to:

http://machineName/projName/MyPage.aspx?myQueryStr=1234

so the issue is moot.

Basically you could

a) have a different url mapping for every possible querystring
possibility (eg. MyPageAbcd.aspx -> MyPage.aspx?myQueryStr=abcd)

b) create a httphandler that takes advantage of Request.RewritePath()
that allows you to parse a request and rewrite the url to the correct
querystring (eg. http://machineName/projName/MyPage/abcd.aspx) and then
map that in your handler to ->
http://machineName/projName/MyPage.aspx?myQueryStr=abcd by parsing
http://machineName/projName/<aspxpage>/<querystringvalue>.aspx.  This
option is really limitless, as long as you know how to parse the
incoming url.

c) your third option isn't as flexible, but requires no url rewriting,
and that is to post all of your data instead of passing in querystring



~kcf


Mark Fitzpatrick wrote:
Show quoteHide quote
> ASP.Net 2.0 has this built right in. What you'll want is the urlmapping
> section of the config file (if I remember correctly). There's also a really
> nice utility at http://www.urlrewriting.net that can do more extensive
> mapping with regular expressions.
>
> --
> Hope this helps,
> Mark Fitzpatrick
> Former Microsoft FrontPage MVP 199?-2006
>
> "Christina" <chrisgir***@gmail.com> wrote in message
> news:1163713938.460440.53870@i42g2000cwa.googlegroups.com...
> > Hiya!!
> >
> > I am trying to do something really simple here..
> >
> > I have a link, clicking on which leads to a page say MyPage.aspx.
> > There's a query string also passed to it. Hence its :
> >
> > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> >
> > Now, I dont want this to be displayed to the user. I want something
> > like:
> > http://machineName/projName/MyPage,
> > on anything, but NOT the querystring.
> >
> > I tried the below code :
> >
> > 1)
> > In global.asax.vb :
> >
> > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> > EventArgs)
> >         Dim strCurrentPath As String
> >         Dim strCustomPath As String
> >
> >        strCurrentPath = Request.Path
> >        strCurrentPath = strCurrentPath.ToLower()
> >        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then
> >
> >            strCustomPath = "http://machineName/projName/MyPage"
> >
> >            Context.RewritePath(strCustomPath)
> >        End If
> >
> > The above code gives an error : Invalid file name for monitoring..
> >
> > 2)
> > In page_load of mypage.aspx
> >        Context.RewritePath(strCustomPath)
> >
> > Still the same error :-(
> >
> > Any pointers ?
> >
> > Thanks!!
> >
Author
17 Nov 2006 7:06 PM
Christina
Hmmm.... doesnt seem to be as simple as I thought it would be.

As kferron  said, I'll focus on : httphandler -> rewrite path ->
parsing..

Meanwhile, if anybody has a link which shows how to do this, or a code
snippet, that would be great!!

Thanks for the help!!


kferron wrote:
Show quoteHide quote
> I don't think this is what she is asking, although urlmapping would
> work for say, http://machineName/projName/MyPage.aspx (if you want
> asp.net to handle files with no extension, this is a webserver setting
> that has to handle the request first), you could map:
>
>
> http://machineName/projName/MyPage.aspx
>
> to
>
> http://machineName/projName/MyPage.aspx?myQueryStr=abcd
>
> you could not say, have MyPage.aspx also map to:
>
> http://machineName/projName/MyPage.aspx?myQueryStr=1234
>
> so the issue is moot.
>
> Basically you could
>
> a) have a different url mapping for every possible querystring
> possibility (eg. MyPageAbcd.aspx -> MyPage.aspx?myQueryStr=abcd)
>
> b) create a httphandler that takes advantage of Request.RewritePath()
> that allows you to parse a request and rewrite the url to the correct
> querystring (eg. http://machineName/projName/MyPage/abcd.aspx) and then
> map that in your handler to ->
> http://machineName/projName/MyPage.aspx?myQueryStr=abcd by parsing
> http://machineName/projName/<aspxpage>/<querystringvalue>.aspx.  This
> option is really limitless, as long as you know how to parse the
> incoming url.
>
> c) your third option isn't as flexible, but requires no url rewriting,
> and that is to post all of your data instead of passing in querystring
>
>
>
> ~kcf
>
>
> Mark Fitzpatrick wrote:
> > ASP.Net 2.0 has this built right in. What you'll want is the urlmapping
> > section of the config file (if I remember correctly). There's also a really
> > nice utility at http://www.urlrewriting.net that can do more extensive
> > mapping with regular expressions.
> >
> > --
> > Hope this helps,
> > Mark Fitzpatrick
> > Former Microsoft FrontPage MVP 199?-2006
> >
> > "Christina" <chrisgir***@gmail.com> wrote in message
> > news:1163713938.460440.53870@i42g2000cwa.googlegroups.com...
> > > Hiya!!
> > >
> > > I am trying to do something really simple here..
> > >
> > > I have a link, clicking on which leads to a page say MyPage.aspx.
> > > There's a query string also passed to it. Hence its :
> > >
> > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > >
> > > Now, I dont want this to be displayed to the user. I want something
> > > like:
> > > http://machineName/projName/MyPage,
> > > on anything, but NOT the querystring.
> > >
> > > I tried the below code :
> > >
> > > 1)
> > > In global.asax.vb :
> > >
> > > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> > > EventArgs)
> > >         Dim strCurrentPath As String
> > >         Dim strCustomPath As String
> > >
> > >        strCurrentPath = Request.Path
> > >        strCurrentPath = strCurrentPath.ToLower()
> > >        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then
> > >
> > >            strCustomPath = "http://machineName/projName/MyPage"
> > >
> > >            Context.RewritePath(strCustomPath)
> > >        End If
> > >
> > > The above code gives an error : Invalid file name for monitoring..
> > >
> > > 2)
> > > In page_load of mypage.aspx
> > >        Context.RewritePath(strCustomPath)
> > >
> > > Still the same error :-(
> > >
> > > Any pointers ?
> > >
> > > Thanks!!
> > >
Author
17 Nov 2006 8:42 PM
kferron
this is a pretty cool approach in my opinion Christina

http://www.codeproject.com/aspnet/urlrewriter.asp



Christina wrote:
Show quoteHide quote
> Hmmm.... doesnt seem to be as simple as I thought it would be.
>
> As kferron  said, I'll focus on : httphandler -> rewrite path ->
> parsing..
>
> Meanwhile, if anybody has a link which shows how to do this, or a code
> snippet, that would be great!!
>
> Thanks for the help!!
>
>
> kferron wrote:
> > I don't think this is what she is asking, although urlmapping would
> > work for say, http://machineName/projName/MyPage.aspx (if you want
> > asp.net to handle files with no extension, this is a webserver setting
> > that has to handle the request first), you could map:
> >
> >
> > http://machineName/projName/MyPage.aspx
> >
> > to
> >
> > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> >
> > you could not say, have MyPage.aspx also map to:
> >
> > http://machineName/projName/MyPage.aspx?myQueryStr=1234
> >
> > so the issue is moot.
> >
> > Basically you could
> >
> > a) have a different url mapping for every possible querystring
> > possibility (eg. MyPageAbcd.aspx -> MyPage.aspx?myQueryStr=abcd)
> >
> > b) create a httphandler that takes advantage of Request.RewritePath()
> > that allows you to parse a request and rewrite the url to the correct
> > querystring (eg. http://machineName/projName/MyPage/abcd.aspx) and then
> > map that in your handler to ->
> > http://machineName/projName/MyPage.aspx?myQueryStr=abcd by parsing
> > http://machineName/projName/<aspxpage>/<querystringvalue>.aspx.  This
> > option is really limitless, as long as you know how to parse the
> > incoming url.
> >
> > c) your third option isn't as flexible, but requires no url rewriting,
> > and that is to post all of your data instead of passing in querystring
> >
> >
> >
> > ~kcf
> >
> >
> > Mark Fitzpatrick wrote:
> > > ASP.Net 2.0 has this built right in. What you'll want is the urlmapping
> > > section of the config file (if I remember correctly). There's also a really
> > > nice utility at http://www.urlrewriting.net that can do more extensive
> > > mapping with regular expressions.
> > >
> > > --
> > > Hope this helps,
> > > Mark Fitzpatrick
> > > Former Microsoft FrontPage MVP 199?-2006
> > >
> > > "Christina" <chrisgir***@gmail.com> wrote in message
> > > news:1163713938.460440.53870@i42g2000cwa.googlegroups.com...
> > > > Hiya!!
> > > >
> > > > I am trying to do something really simple here..
> > > >
> > > > I have a link, clicking on which leads to a page say MyPage.aspx.
> > > > There's a query string also passed to it. Hence its :
> > > >
> > > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > > >
> > > > Now, I dont want this to be displayed to the user. I want something
> > > > like:
> > > > http://machineName/projName/MyPage,
> > > > on anything, but NOT the querystring.
> > > >
> > > > I tried the below code :
> > > >
> > > > 1)
> > > > In global.asax.vb :
> > > >
> > > > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> > > > EventArgs)
> > > >         Dim strCurrentPath As String
> > > >         Dim strCustomPath As String
> > > >
> > > >        strCurrentPath = Request.Path
> > > >        strCurrentPath = strCurrentPath.ToLower()
> > > >        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then
> > > >
> > > >            strCustomPath = "http://machineName/projName/MyPage"
> > > >
> > > >            Context.RewritePath(strCustomPath)
> > > >        End If
> > > >
> > > > The above code gives an error : Invalid file name for monitoring..
> > > >
> > > > 2)
> > > > In page_load of mypage.aspx
> > > >        Context.RewritePath(strCustomPath)
> > > >
> > > > Still the same error :-(
> > > >
> > > > Any pointers ?
> > > >
> > > > Thanks!!
> > > >
Author
17 Nov 2006 9:32 PM
Christina
Thanks !!
I will implement it and let you know how'd it go..


kferron wrote:
Show quoteHide quote
> this is a pretty cool approach in my opinion Christina
>
> http://www.codeproject.com/aspnet/urlrewriter.asp
>
>
>
> Christina wrote:
> > Hmmm.... doesnt seem to be as simple as I thought it would be.
> >
> > As kferron  said, I'll focus on : httphandler -> rewrite path ->
> > parsing..
> >
> > Meanwhile, if anybody has a link which shows how to do this, or a code
> > snippet, that would be great!!
> >
> > Thanks for the help!!
> >
> >
> > kferron wrote:
> > > I don't think this is what she is asking, although urlmapping would
> > > work for say, http://machineName/projName/MyPage.aspx (if you want
> > > asp.net to handle files with no extension, this is a webserver setting
> > > that has to handle the request first), you could map:
> > >
> > >
> > > http://machineName/projName/MyPage.aspx
> > >
> > > to
> > >
> > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > >
> > > you could not say, have MyPage.aspx also map to:
> > >
> > > http://machineName/projName/MyPage.aspx?myQueryStr=1234
> > >
> > > so the issue is moot.
> > >
> > > Basically you could
> > >
> > > a) have a different url mapping for every possible querystring
> > > possibility (eg. MyPageAbcd.aspx -> MyPage.aspx?myQueryStr=abcd)
> > >
> > > b) create a httphandler that takes advantage of Request.RewritePath()
> > > that allows you to parse a request and rewrite the url to the correct
> > > querystring (eg. http://machineName/projName/MyPage/abcd.aspx) and then
> > > map that in your handler to ->
> > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd by parsing
> > > http://machineName/projName/<aspxpage>/<querystringvalue>.aspx.  This
> > > option is really limitless, as long as you know how to parse the
> > > incoming url.
> > >
> > > c) your third option isn't as flexible, but requires no url rewriting,
> > > and that is to post all of your data instead of passing in querystring
> > >
> > >
> > >
> > > ~kcf
> > >
> > >
> > > Mark Fitzpatrick wrote:
> > > > ASP.Net 2.0 has this built right in. What you'll want is the urlmapping
> > > > section of the config file (if I remember correctly). There's also a really
> > > > nice utility at http://www.urlrewriting.net that can do more extensive
> > > > mapping with regular expressions.
> > > >
> > > > --
> > > > Hope this helps,
> > > > Mark Fitzpatrick
> > > > Former Microsoft FrontPage MVP 199?-2006
> > > >
> > > > "Christina" <chrisgir***@gmail.com> wrote in message
> > > > news:1163713938.460440.53870@i42g2000cwa.googlegroups.com...
> > > > > Hiya!!
> > > > >
> > > > > I am trying to do something really simple here..
> > > > >
> > > > > I have a link, clicking on which leads to a page say MyPage.aspx.
> > > > > There's a query string also passed to it. Hence its :
> > > > >
> > > > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > > > >
> > > > > Now, I dont want this to be displayed to the user. I want something
> > > > > like:
> > > > > http://machineName/projName/MyPage,
> > > > > on anything, but NOT the querystring.
> > > > >
> > > > > I tried the below code :
> > > > >
> > > > > 1)
> > > > > In global.asax.vb :
> > > > >
> > > > > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> > > > > EventArgs)
> > > > >         Dim strCurrentPath As String
> > > > >         Dim strCustomPath As String
> > > > >
> > > > >        strCurrentPath = Request.Path
> > > > >        strCurrentPath = strCurrentPath.ToLower()
> > > > >        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then
> > > > >
> > > > >            strCustomPath = "http://machineName/projName/MyPage"
> > > > >
> > > > >            Context.RewritePath(strCustomPath)
> > > > >        End If
> > > > >
> > > > > The above code gives an error : Invalid file name for monitoring..
> > > > >
> > > > > 2)
> > > > > In page_load of mypage.aspx
> > > > >        Context.RewritePath(strCustomPath)
> > > > >
> > > > > Still the same error :-(
> > > > >
> > > > > Any pointers ?
> > > > >
> > > > > Thanks!!
> > > > >
Author
17 Nov 2006 9:39 PM
Christina
Hey, I would like to consider the third approach also:
post all of your data instead of passing in querystring

Can I get a pointer to that too..

Thanx!!


kferron wrote:
Show quoteHide quote
> this is a pretty cool approach in my opinion Christina
>
> http://www.codeproject.com/aspnet/urlrewriter.asp
>
>
>
> Christina wrote:
> > Hmmm.... doesnt seem to be as simple as I thought it would be.
> >
> > As kferron  said, I'll focus on : httphandler -> rewrite path ->
> > parsing..
> >
> > Meanwhile, if anybody has a link which shows how to do this, or a code
> > snippet, that would be great!!
> >
> > Thanks for the help!!
> >
> >
> > kferron wrote:
> > > I don't think this is what she is asking, although urlmapping would
> > > work for say, http://machineName/projName/MyPage.aspx (if you want
> > > asp.net to handle files with no extension, this is a webserver setting
> > > that has to handle the request first), you could map:
> > >
> > >
> > > http://machineName/projName/MyPage.aspx
> > >
> > > to
> > >
> > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > >
> > > you could not say, have MyPage.aspx also map to:
> > >
> > > http://machineName/projName/MyPage.aspx?myQueryStr=1234
> > >
> > > so the issue is moot.
> > >
> > > Basically you could
> > >
> > > a) have a different url mapping for every possible querystring
> > > possibility (eg. MyPageAbcd.aspx -> MyPage.aspx?myQueryStr=abcd)
> > >
> > > b) create a httphandler that takes advantage of Request.RewritePath()
> > > that allows you to parse a request and rewrite the url to the correct
> > > querystring (eg. http://machineName/projName/MyPage/abcd.aspx) and then
> > > map that in your handler to ->
> > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd by parsing
> > > http://machineName/projName/<aspxpage>/<querystringvalue>.aspx.  This
> > > option is really limitless, as long as you know how to parse the
> > > incoming url.
> > >
> > > c) your third option isn't as flexible, but requires no url rewriting,
> > > and that is to post all of your data instead of passing in querystring
> > >
> > >
> > >
> > > ~kcf
> > >
> > >
> > > Mark Fitzpatrick wrote:
> > > > ASP.Net 2.0 has this built right in. What you'll want is the urlmapping
> > > > section of the config file (if I remember correctly). There's also a really
> > > > nice utility at http://www.urlrewriting.net that can do more extensive
> > > > mapping with regular expressions.
> > > >
> > > > --
> > > > Hope this helps,
> > > > Mark Fitzpatrick
> > > > Former Microsoft FrontPage MVP 199?-2006
> > > >
> > > > "Christina" <chrisgir***@gmail.com> wrote in message
> > > > news:1163713938.460440.53870@i42g2000cwa.googlegroups.com...
> > > > > Hiya!!
> > > > >
> > > > > I am trying to do something really simple here..
> > > > >
> > > > > I have a link, clicking on which leads to a page say MyPage.aspx.
> > > > > There's a query string also passed to it. Hence its :
> > > > >
> > > > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > > > >
> > > > > Now, I dont want this to be displayed to the user. I want something
> > > > > like:
> > > > > http://machineName/projName/MyPage,
> > > > > on anything, but NOT the querystring.
> > > > >
> > > > > I tried the below code :
> > > > >
> > > > > 1)
> > > > > In global.asax.vb :
> > > > >
> > > > > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> > > > > EventArgs)
> > > > >         Dim strCurrentPath As String
> > > > >         Dim strCustomPath As String
> > > > >
> > > > >        strCurrentPath = Request.Path
> > > > >        strCurrentPath = strCurrentPath.ToLower()
> > > > >        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then
> > > > >
> > > > >            strCustomPath = "http://machineName/projName/MyPage"
> > > > >
> > > > >            Context.RewritePath(strCustomPath)
> > > > >        End If
> > > > >
> > > > > The above code gives an error : Invalid file name for monitoring..
> > > > >
> > > > > 2)
> > > > > In page_load of mypage.aspx
> > > > >        Context.RewritePath(strCustomPath)
> > > > >
> > > > > Still the same error :-(
> > > > >
> > > > > Any pointers ?
> > > > >
> > > > > Thanks!!
> > > > >
Author
18 Nov 2006 12:32 AM
Christina
I tried to used HTTPModule:

In the Application_BeginRequest, after checkin the URL, ie if its
/myFolder/URL.aspx, then i am using
HttpContext.Current.RewritePath("/myFolder/newURL.aspx") to rewrite the
URL.

Now, this is the result:
I type http://MachineName/myFolder/URL.apx,
it displays the page - newURL.aspx (but in the addressbar, its
http://MachineName/myFolder/URL.apx).

I wanted it to be other way round, ie
I type http://MachineName/myFolder/URL.apx,
it displays the page - URL.aspx (but changes the url in the addressbar
to - http://MachineName/myFolder/newURL.apx).

The reason is, my orignal link has a querystring attached to it. Now I
dont want the user to see the query string. So I want the page to be
displayed as it would have (with the querystring), but want to display
the URL without the querystring. I wanted to rewrite just my Url (in
the addressbar) to the same url(but without query string).

Any idea ??

Thanks!!

Christina wrote:
Show quoteHide quote
> Hey, I would like to consider the third approach also:
> post all of your data instead of passing in querystring
>
> Can I get a pointer to that too..
>
> Thanx!!
>
>
> kferron wrote:
> > this is a pretty cool approach in my opinion Christina
> >
> > http://www.codeproject.com/aspnet/urlrewriter.asp
> >
> >
> >
> > Christina wrote:
> > > Hmmm.... doesnt seem to be as simple as I thought it would be.
> > >
> > > As kferron  said, I'll focus on : httphandler -> rewrite path ->
> > > parsing..
> > >
> > > Meanwhile, if anybody has a link which shows how to do this, or a code
> > > snippet, that would be great!!
> > >
> > > Thanks for the help!!
> > >
> > >
> > > kferron wrote:
> > > > I don't think this is what she is asking, although urlmapping would
> > > > work for say, http://machineName/projName/MyPage.aspx (if you want
> > > > asp.net to handle files with no extension, this is a webserver setting
> > > > that has to handle the request first), you could map:
> > > >
> > > >
> > > > http://machineName/projName/MyPage.aspx
> > > >
> > > > to
> > > >
> > > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > > >
> > > > you could not say, have MyPage.aspx also map to:
> > > >
> > > > http://machineName/projName/MyPage.aspx?myQueryStr=1234
> > > >
> > > > so the issue is moot.
> > > >
> > > > Basically you could
> > > >
> > > > a) have a different url mapping for every possible querystring
> > > > possibility (eg. MyPageAbcd.aspx -> MyPage.aspx?myQueryStr=abcd)
> > > >
> > > > b) create a httphandler that takes advantage of Request.RewritePath()
> > > > that allows you to parse a request and rewrite the url to the correct
> > > > querystring (eg. http://machineName/projName/MyPage/abcd.aspx) and then
> > > > map that in your handler to ->
> > > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd by parsing
> > > > http://machineName/projName/<aspxpage>/<querystringvalue>.aspx.  This
> > > > option is really limitless, as long as you know how to parse the
> > > > incoming url.
> > > >
> > > > c) your third option isn't as flexible, but requires no url rewriting,
> > > > and that is to post all of your data instead of passing in querystring
> > > >
> > > >
> > > >
> > > > ~kcf
> > > >
> > > >
> > > > Mark Fitzpatrick wrote:
> > > > > ASP.Net 2.0 has this built right in. What you'll want is the urlmapping
> > > > > section of the config file (if I remember correctly). There's also a really
> > > > > nice utility at http://www.urlrewriting.net that can do more extensive
> > > > > mapping with regular expressions.
> > > > >
> > > > > --
> > > > > Hope this helps,
> > > > > Mark Fitzpatrick
> > > > > Former Microsoft FrontPage MVP 199?-2006
> > > > >
> > > > > "Christina" <chrisgir***@gmail.com> wrote in message
> > > > > news:1163713938.460440.53870@i42g2000cwa.googlegroups.com...
> > > > > > Hiya!!
> > > > > >
> > > > > > I am trying to do something really simple here..
> > > > > >
> > > > > > I have a link, clicking on which leads to a page say MyPage.aspx.
> > > > > > There's a query string also passed to it. Hence its :
> > > > > >
> > > > > > http://machineName/projName/MyPage.aspx?myQueryStr=abcd
> > > > > >
> > > > > > Now, I dont want this to be displayed to the user. I want something
> > > > > > like:
> > > > > > http://machineName/projName/MyPage,
> > > > > > on anything, but NOT the querystring.
> > > > > >
> > > > > > I tried the below code :
> > > > > >
> > > > > > 1)
> > > > > > In global.asax.vb :
> > > > > >
> > > > > > Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> > > > > > EventArgs)
> > > > > >         Dim strCurrentPath As String
> > > > > >         Dim strCustomPath As String
> > > > > >
> > > > > >        strCurrentPath = Request.Path
> > > > > >        strCurrentPath = strCurrentPath.ToLower()
> > > > > >        If (strCurrentPath.IndexOf("/MyPage.aspx") > -1) Then
> > > > > >
> > > > > >            strCustomPath = "http://machineName/projName/MyPage"
> > > > > >
> > > > > >            Context.RewritePath(strCustomPath)
> > > > > >        End If
> > > > > >
> > > > > > The above code gives an error : Invalid file name for monitoring..
> > > > > >
> > > > > > 2)
> > > > > > In page_load of mypage.aspx
> > > > > >        Context.RewritePath(strCustomPath)
> > > > > >
> > > > > > Still the same error :-(
> > > > > >
> > > > > > Any pointers ?
> > > > > >
> > > > > > Thanks!!
> > > > > >
Author
19 Nov 2006 6:57 PM
Holger Boskugel
Hello Christina

Show quoteHide quote
> In the Application_BeginRequest, after checkin the URL, ie if its
> /myFolder/URL.aspx, then i am using
> HttpContext.Current.RewritePath("/myFolder/newURL.aspx") to rewrite the
> URL.
>
> Now, this is the result:
> I type http://MachineName/myFolder/URL.apx,
> it displays the page - newURL.aspx (but in the addressbar, its
> http://MachineName/myFolder/URL.apx).
>
> I wanted it to be other way round, ie
> I type http://MachineName/myFolder/URL.apx,
> it displays the page - URL.aspx (but changes the url in the addressbar
> to - http://MachineName/myFolder/newURL.apx).
>
> The reason is, my orignal link has a querystring attached to it. Now I
> dont want the user to see the query string. So I want the page to be
> displayed as it would have (with the querystring), but want to display
> the URL without the querystring. I wanted to rewrite just my Url (in
> the addressbar) to the same url(but without query string).
>
> Any idea ??

put the Query data in you session an make a redirect to the URL you
want and then pick up the Query from your Session.


Regards

Holger