Hi,

I'm having a problem when my friendly url path contains ".aspx". When the path contains ".aspx" all usage of "~/" is resolved incorrectly.


For example: When the friendly url is something like this: http://www.example.com/a/b/c/d.aspx
then the tilde "~" is resolved as "../../../" which is good.

BUT, when the friendly url is something like this: http://www.example.com/a/b/c.aspx/d.aspx
then the tilde "~" is resolved as "../../" which is bad! should be "../../../".

I think the ResolveClientUrl which is used when resolving "~" thinks that "c.aspx" is the file and should stop resolving at this point instead of continuing to "d.aspx"

Any suggestions? Thanks.

Root (~) operator is only used with Server Controls.

try this

HttpContext.Current.Request.PhysicalApplicationPath

Thanks for the replies.

I'm not looking to use an alternative to the ~, I want to understand why ~ is not working properly. Something is broken.

I did some testing and i found that ResolveClientUrl does not resolve properly. I think the problem is there.

Thanks.

Thanks for the replies.

I'm not looking to use an alternative to the ~, I want to understand why ~ is not working properly. Something is broken.

I did some testing and i found that ResolveClientUrl does not resolve properly. I think the problem is there.

Thanks.

adatapost>It's working with server control. Can you post a segement of your code?

make sure that you are using the "~" for server control only.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.