Using ?delete= query string causes issues in Umbraco 4.5.3
Hi Guys,
I recently found this and thought I'd share it with you, in case anybody else also comes across it.[I couldn't find it in a quick search already]
I had a usercontrol in the backend site which was using the query string:
?delete=somestringidentifier
This started to cause problems, when the string was not numeric, the action was not being carried out as expected, and throwing errors.
I quickly tracked it down to KeyValuePrevalueEditor.cs in umbraco.editorControls.KeyValuePrevalueEditor - you can guess what's coming... I found this code:
// Bootstrap delete.
if (System.Web.HttpContext.Current.Request["delete"] != null) {
DeletePrevalue(int.Parse(System.Web.HttpContext.Current.Request["delete"]));
}
}
private void DeletePrevalue(int id) {
SqlHelper.ExecuteNonQuery("delete from cmsDataTypePreValues where id = " + id);
}
Looks like my choice of querystring has already been taken!! A string value wouldn't cast to an integer and threw an exception!
Quick fix: Change your query string!!
Hopefully this should help someone else out, by either avoiding this in the first place, or looking for the solution using the search.
Using ?delete= query string causes issues in Umbraco 4.5.3
Hi Guys,
I recently found this and thought I'd share it with you, in case anybody else also comes across it.[I couldn't find it in a quick search already]
I had a usercontrol in the backend site which was using the query string:
This started to cause problems, when the string was not numeric, the action was not being carried out as expected, and throwing errors.
I quickly tracked it down to KeyValuePrevalueEditor.cs in umbraco.editorControls.KeyValuePrevalueEditor - you can guess what's coming... I found this code:
Looks like my choice of querystring has already been taken!! A string value wouldn't cast to an integer and threw an exception!
Quick fix: Change your query string!!
Hopefully this should help someone else out, by either avoiding this in the first place, or looking for the solution using the search.
is working on a reply...