Usercontrol URL Re-written Options
Richard
Posted: Monday, November 05, 2007 5:00:44 PM
Rank: Enthusiast

Joined: 9/7/2007
Posts: 16
Location: UK

I have created an ASP.net wizard usercontrol, which has a few steps. As you step through the wizard the page URL changes from:

http://server.domain.com/pageName

to:

http://server.domain.com/%2fpageName

The "%2f" is the URL encoded value for "/"

Also it gets changed to:

http://server.domain.com/default.aspx?umbPage=%2fpageName

Which works OK while you are progressing forwards, though it is not pretty. But if you use the previous button you get a 404, page not found. Do you know of a way to keep the URL as "/pageName"? Has anyone else experienced and solved this problem?

Cheers
Richard
imayat12
Posted: Monday, November 05, 2007 6:01:55 PM

Rank: Addict

Joined: 7/19/2006
Posts: 542
Location: Preston, UK
Just to update! This looks like a wizard control with ajax update panel issue. So when ajax panel is removed the url stuff works.

Has anyone come across this issue before which isnt really an umbraco issue!

Regards

Ismail

Level 2 certified. If it aint broke dont fix.
Richard
Posted: Tuesday, November 06, 2007 5:12:44 PM
Rank: Enthusiast

Joined: 9/7/2007
Posts: 16
Location: UK
When asp:UpdatePanel is used, and a control does an Ajax call the form's action is not being HTML decoded, so /directory/pageName is written as %2fdirectory%2fpageName. I would expect that this then causes Umbraco a problem in not being able to work out which page should process the post back.

Richard
Richard
Posted: Wednesday, November 07, 2007 12:39:17 PM
Rank: Enthusiast

Joined: 9/7/2007
Posts: 16
Location: UK

The fix I have implemented is to include some JavaScript and JQuery to HTML decode the form's action. This relies on JavaScript being turned on on the client, so if there is another method of resolving this that would be appreciated.

Richard

I created a JavaScript file containing the following code and called at the start of the wizard.

Code:

(function($) {
    
    var theAction;

    // Get the action, e.g. %2fdirectory%2fpageName
    theAction = $("form").attr("action");

    // Replace all (using the g flag) of %2f with "/"
    theAction = theAction.replace(/%2f/g, "/");
    
    // Write this text back to the form's action
    $("form").attr({action: theAction});
            
})(jQuery);

thomwhaites
Posted: Friday, April 25, 2008 4:53:43 PM
Rank: Fanatic

Joined: 7/20/2006
Posts: 256
Location: Boston, Massachusetts
Hi Richard,

I'm having the same issue you described using an Ajax UpdatePanel (.net 2.0) in my control. I'm really not that familiar w/ javascript & jquery - could you show me a snippet of how I'd call your work around from my control. Do I need to include a js library as well?

Thanks,
Tom

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.