Wednesday, May 21, 2008

Knowledge Pass (Pure Technical)

Which Problem ? Which Solution ?
Which Error ? Which Fix ?

..... just add on here

3 comments:

Anil said...

(1) Problem : In ASP.NET form submission , sometimes this error is thrown : A Potentially dangerous form was submitted" .
Fix : in aspx page just add : ValidateRequest="false". If this does not fix problem , reply here .

Anil said...

If you face issues while using : ServicePointManager class and the exception is like this :
An exception was thrown by the type initializer for System.Net.ServicePointManager

Details : System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.ServicePointManager ---> System.Configuration.ConfigurationException: Duplicate element in collection
at System.Configuration.ConfigurationElementCollection.BaseAdd (System.Configuration.ConfigurationElement element, Boolean throwIfExists) [0x00000]
at System.Configuration.ConfigurationElementCollection.BaseAdd (System.Configuration.ConfigurationElement element) [0x00000]
at System.Configuration.ConfigurationElementCollection.OnDeserializeUnrecognizedElement (System.String elementName, System.Xml.XmlReader reader) [0x00000]
at System.Configuration.ConfigurationElement.DeserializeElement (System.Xml.XmlReader reader, Boolean serializeCollectionKey) [0x00000]
at System.Configuration.ConfigurationSection.DoDeserializeSection (System.Xml.XmlReader reader) [0x00000]
at System.Configuration.ConfigurationSection.DeserializeSection (System.Xml.XmlReader reader) [0x00000]
at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000]
at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000]
at System.Configuration.Configuration.GetSection (System.String path) [0x00000]
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000]
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000]
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName) [0x00000]
at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000]
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000]
at System.Net.ServicePointManager..cctor () [0x00000]


On Linux when using MONO

This can happen when the machine was upgraded from Mono 1.2 to Mono 2.0 (but not always :-) ).
I will tell how :

If you application has a web.config file which has entry like this :
system.net
connectionManagement
add address="*" maxconnection="10"
connectionManagement
system.net

Now, inside "/etc/mono/2.0/machine.config" file, there is another entry for
connectionManagement. so this may creat a duplicate entry problem
and throw exception. Although this entry was present
in Mono 1.2's machine.config file also but obviously that was not throwing
error so earlier with Mono 1.2 everything was fine.

A Workaround for this problem is that : add one more tag "<" clear "/>" in our
web.config file before connemctionManagement tag s.t. it becomes like system.net
"<"clear "/>"
connectionManagement
add address="*" maxconnection="10"
connectionManagement
system.net

and it stops giving the
error. and our webservice call through SOAP passes.

Hope it helps other who face the issue.

Anil said...

if above solution does not work then try putting "clear" tag after the line where connectionManagement tag appears for the first time