I am passing parameters around a site in the URL by using page.aspx/value in the URL instead of page.aspx?key=value
The problem I am running into is ~ doesn't work.
Say I'm in a page such as "foldera/folderb/default.aspx/value" and it uses an image referenced as "~/image.jpg"
The correct location is "/foldera/folderb/image.jpg"
Instead the location is being rendered as "/foldera/folderb/default.aspx/image.jpg"
Within my own code, this is A-OK, I can subsitute by hand quite easily. The problem comes in the AjaxControlKit, which references images and scripts using "~/WebResource.axd" but i'm getting "default.aspx/WebResource.axd" which of course is a problem, since its not referencing the script and image IIS extension, but is instead accessing the page it called from.
Does anyone have a good solution? It has been quite common in my apps to use fake URLs to pass parameters because it is search engine friendly but this one has me stuck. I know AjaxControlKit has its source code available, but I don't want to have to modify the code for something so dumb...
Maybe there is a way to override the URL parsing? (probably not, but had to ask)
Dan
Do you have some url rewriting engine driving ur parameterised urls? It seems like that must be where your parsing difficulties are occurring. I use url rewriting and it doesn't screw with "~".
Sounds like a bug. Are you parsing the url "yourself" to get at the values or are you using RewritePath? If you're not using RewritePath it might be a good idea to do that.
I don't use any form of URL rewriting...the Tail is automatically ignored by ASP.NET and IIS for delivering the page...
I read the Page URL during my state class's creation during each pages PreInit() method, and all it does is a quick non-destructive parse looking for expected values after the page.aspx/
My understanding of using the rewriting functions is they cause a transparent redirect...
I just want ASP.NET to render properally; after all it knew what page to actually load with the tail...
You shouldn't have to, but right now I think you'll have to implement rewriting. That way, your page will think it's called as page.aspx?key=val, and the url resolving should not fail.
I actually think it's a much cleaner approach than parsing the url in PreInit.
No comments:
Post a Comment