here is my code, when i create an attribute if it is not present:
if (httpRuntime.MoveToAttribute("maxRequestLength", ""))
httpRuntime.SetValue("2097151");
else
httpRuntime.CreateAttribute("", "maxRequestLength", "", "2097151");
Thanx
Your current node is not on the element. Move it there first.