Tilde ~ causes problem - URL Rewrite

Tilde ~ causes problem - URL Rewrite

am 26.12.2007 07:21:12 von Harsh Trivedi

Hi,

We have implemented URL rewriting in our site. It all went OK till
home page links.

When we click on home page category control, where we have implemented
rewriting, it works ok, and open subcategory listing page.

problem comes now...

on the sub category listing page also, we have implemented url
rewriting.... but by all surprize it is showing wrong path where we
have use ~ [tilde].

E.g. ~/Images/Pen.jgp... the ~ should replace with the configured
virtual directory, but it resolves the path of ~ with changed URL
path, that is rewriten.


I am stuck with this problem, all images and hyperlinks having ~ shows
wrong path....

can anyone please help...?

Re: Tilde ~ causes problem - URL Rewrite

am 26.12.2007 10:35:21 von l.holota

Hi,

solved this either, you have to use complete absolute paths like
http://www.example.com/Images/...., or do it like me :) creare rewrite rules
with regular expressions - rewrite wrong paths to the right ones. I have my
own rewriting module, so it was easy...

Regards,

Lukas Holota

"Harsh Trivedi" wrote in message
news:c3cbc12b-cf2b-4d3e-9f44-aac484b789b3@i29g2000prf.google groups.com...
> Hi,
>
> We have implemented URL rewriting in our site. It all went OK till
> home page links.
>
> When we click on home page category control, where we have implemented
> rewriting, it works ok, and open subcategory listing page.
>
> problem comes now...
>
> on the sub category listing page also, we have implemented url
> rewriting.... but by all surprize it is showing wrong path where we
> have use ~ [tilde].
>
> E.g. ~/Images/Pen.jgp... the ~ should replace with the configured
> virtual directory, but it resolves the path of ~ with changed URL
> path, that is rewriten.
>
>
> I am stuck with this problem, all images and hyperlinks having ~ shows
> wrong path....
>
> can anyone please help...?

Re: Tilde ~ causes problem - URL Rewrite

am 26.12.2007 13:04:56 von Harsh Trivedi

We have written like this:

1) Place the function to rewrite in global.asax file in Begin request
event
2) Create the function that will be called by step -1
3) Create the xml file for url mapping and use Reg ex
4) Once false path is found for the url,
HttpContext.Current.RewritePath(newPath)

On Dec 26, 2:35 pm, wrote:
> Hi,
>
> solved this either, you have to use complete absolute paths likehttp://www.example.com/Images/...., or do it like me :) creare rewrite rules
> with regular expressions - rewrite wrong paths to the right ones. I have my
> own rewriting module, so it was easy...
>
> Regards,
>
> Lukas Holota
>
> "Harsh Trivedi" wrote in message
>
> news:c3cbc12b-cf2b-4d3e-9f44-aac484b789b3@i29g2000prf.google groups.com...
>
> > Hi,
>
> > We have implemented URL rewriting in our site. It all went OK till
> > home page links.
>
> > When we click on home page category control, where we have implemented
> > rewriting, it works ok, and open subcategory listing page.
>
> > problem comes now...
>
> > on the sub category listing page also, we have implemented url
> > rewriting.... but by all surprize it is showing wrong path where we
> > have use ~ [tilde].
>
> > E.g. ~/Images/Pen.jgp... the ~ should replace with the configured
> > virtual directory, but it resolves the path of ~ with changed URL
> > path, that is rewriten.
>
> > I am stuck with this problem, all images and hyperlinks having ~ shows
> > wrong path....
>
> > can anyone please help...?

Re: Tilde ~ causes problem - URL Rewrite

am 26.12.2007 14:40:59 von Med

Hi,

Try Page.ResolveUrl("~/Images/Pen.jpg") or
Page.ResolveClientUrl("~/Images/Pen.jpg") see if it works.


Regards

Med



"Harsh Trivedi" wrote in message
news:c3cbc12b-cf2b-4d3e-9f44-aac484b789b3@i29g2000prf.google groups.com...
> Hi,
>
> We have implemented URL rewriting in our site. It all went OK till
> home page links.
>
> When we click on home page category control, where we have implemented
> rewriting, it works ok, and open subcategory listing page.
>
> problem comes now...
>
> on the sub category listing page also, we have implemented url
> rewriting.... but by all surprize it is showing wrong path where we
> have use ~ [tilde].
>
> E.g. ~/Images/Pen.jgp... the ~ should replace with the configured
> virtual directory, but it resolves the path of ~ with changed URL
> path, that is rewriten.
>
>
> I am stuck with this problem, all images and hyperlinks having ~ shows
> wrong path....
>
> can anyone please help...?

Re: Tilde ~ causes problem - URL Rewrite

am 28.12.2007 00:33:42 von l.holota

I recommend to implement this as an IHttpModule, it's more practical and
easier to implement to other applications

Regards,

L.Holota

"Harsh Trivedi" wrote in message
news:07bbc2c1-91cd-49d8-9b09-6931b781b223@b40g2000prf.google groups.com...
> We have written like this:
>
> 1) Place the function to rewrite in global.asax file in Begin request
> event
> 2) Create the function that will be called by step -1
> 3) Create the xml file for url mapping and use Reg ex
> 4) Once false path is found for the url,
> HttpContext.Current.RewritePath(newPath)
>
> On Dec 26, 2:35 pm, wrote:
>> Hi,
>>
>> solved this either, you have to use complete absolute paths
>> likehttp://www.example.com/Images/...., or do it like me :) creare
>> rewrite rules
>> with regular expressions - rewrite wrong paths to the right ones. I have
>> my
>> own rewriting module, so it was easy...
>>
>> Regards,
>>
>> Lukas Holota
>>
>> "Harsh Trivedi" wrote in message
>>
>> news:c3cbc12b-cf2b-4d3e-9f44-aac484b789b3@i29g2000prf.google groups.com...
>>
>> > Hi,
>>
>> > We have implemented URL rewriting in our site. It all went OK till
>> > home page links.
>>
>> > When we click on home page category control, where we have implemented
>> > rewriting, it works ok, and open subcategory listing page.
>>
>> > problem comes now...
>>
>> > on the sub category listing page also, we have implemented url
>> > rewriting.... but by all surprize it is showing wrong path where we
>> > have use ~ [tilde].
>>
>> > E.g. ~/Images/Pen.jgp... the ~ should replace with the configured
>> > virtual directory, but it resolves the path of ~ with changed URL
>> > path, that is rewriten.
>>
>> > I am stuck with this problem, all images and hyperlinks having ~ shows
>> > wrong path....
>>
>> > can anyone please help...?
>