MVC Url with query string fails if the query string ends in

Posted by Community Admin on 04-Aug-2018 22:08

MVC Url with query string fails if the query string ends in a period

All Replies

Posted by Community Admin on 16-Oct-2014 00:00

I am running Sitefinity using Hybrid MVC mode. Within my view, I redirect the page to the following URL that has a query string parameter with a trailing period

 localhost:18806/.../

 which fails with the following error:

 Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /programactivities/registration/Error/An unknown error occurred while trying to accept the conditions./

 However, if I remove the trailing period in the URL or move the period to anywhere else in the query string, the redirect is successful. For example, the following URLs work:

period at beginning of query string

 localhost:18806/.../

period in middle of query string

localhost:18806/.../

 periods all over the place except at the end

localhost:18806/.../


Posted by Community Admin on 17-Oct-2014 00:00

Even worse, I am getting the following error when there is an encoded colon in the query string.

A potentially dangerous Request.Path value was detected from the client (:).

Here's the URL:

localhost:18806/.../

 Both of the problems (trailing period and escaped colon) seem like inherent problems with the way Sitefinity passes the query string parameters. Is there some way I can pass arbitrary encoded query string parameters to my controller action without worrying about the URL being considered malformed or dangerous?

 In the meantime, I'm going to look into using HttpPost as a workaround.

Posted by Community Admin on 21-Oct-2014 00:00

Hello Bo,

The first problem you have reported is standard behavior. The MVC framework tends to treat periods as delimiters. Please try adding the following to your web.config's HTTPRuntime tag:

<httpRuntime relaxedUrlToFileSystemMapping="true" />

Regarding the second problem - you should not experience the error seeing that you have encoded your URL request. Your workaround is plausible but in general I would advise you refrain from including special characters in your URL. 

Regards,
Ivan D. Dimitrov
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 17-Mar-2015 00:00

Wondering if you remember how  you resolved this error:

 "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

This thread is closed