When you access an ASP.NET page in your browser, you may get an XML Parsing Error that says that the XML is not well formed. The error message also displays the page directive statement present in the 1st line of the .aspx file. First we will fix this error, then we will look at one possible reason why you may be getting this error in ASP.NET.

Click Start > Run, and type the following command depending on which ASP.NET framework is in use by the default web site in your IIS.
%Windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
%Windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe -i
You should see a command window that is displayed briefly, that shows that ASP.NET is being installed. After the registration is successful, the window will be closed. 
Now refresh the .aspx page that you got the XML Parser error for in the browser and your page should be rendered correctly.
I have seen this error happen to me in situations where I had installed IIS after the installing the .Net Framework. This make sense. If you install IIS after you install the .Net Framework, then the framework is not registered with IIS. So when a request for a .aspx page comes to IIS, it simply passes on the contents of the page as-is without processing it. So in effect, the browser receives the entire .aspx page’s code, tried to parse it as an XML file, encounters the parsing error at the second character in the page directive and stops.
Related: ASP.NET IIS Registration Tool
Xml Parsing error (error code 29) Line 21, column 2 of file
This was really useful in solving the exact same problem. The “why did you get this error” made a whole lot of difference in understanding exactly how we got the error in the first place and how to get it fixed.
Just for record, the software we were trying implement was relying on an earlier version of .net, so changing the version used in “Properties” of the relevant virtual folder was part of the problem. Followed by the reinstall as mentioned above.
Much appreciated, thanks.
Open IIS .
Select DefaultWebsite->Properties->ASP.NET Tab
Then Select ASP.NET version from the Combobox.
Regards
RAJ
i have asp.net 2 and IIS 5 and i got this problem and try all your solution i wrote the command and change the property in virtual directory and no benefit then i uninstall vs2005 and IIS5 then install them again starting with IIS5 then vs2005
and no benefit i dont know what to do please
Thanks wrked like a charm..
Thank you very much!!!!
first it didn’t work for me but i reinstall the iis and then register it. it works. :)
thanks
thanks a lot man…
thanks man…
Thanx
its working fine, but my servername gets changes e.g
My servername is ABC it makes to “ABCASPNET” after publishing web site
fabulous…..fantastic…….u rocked…man….maza aa gya..
Wow!!
Thank you so much!!
My whole team was in trouble from last 2 days with it, now i have fixed it with your help.
Keep on man!
it’s really a good helpful post………..
Thank you so much again…….
Thank you so much
But I have installed .NET 3.5
In such case what can i do?
@Yong. According to a response in this thread, it seems that “ASP.NET 3.5 runs on top of ASP.NET 2.0, almost like a service pack”.
Also, from this MSDN Article on aspnet_regiis.exe specific to .Net 3.5, it is still saying that you should register the 2.x aspnet_regiis.exe version.
So I would suggest you try this out first and see if that helps !
-Shiva
You’re right
but every time i must use that command
what can i do?
I’ll appreciate if you suggest better way!
Thanks!
The registration should be a 1 time thing. Are you having to do it every time ?
If yes, then can you try adding the Compilers section / Compiler directives in your web.config (see this thread for the actual code to add)
Hi Shiva…
Thanks a lot… it helped ..!
appreciate the way you explained….
I don’t normally leave message, but this time I must say thank you very much
Thanks A Ton !!
U Gave Th Solution In Best Possible Way…
Thanks A Ton..
Thank you very much
go on
it really worked for me.. gr8 job…
thank you very much you are help me alot
What coomand should give for asp.net 3.5
It worked only once. Next time when i tried open window still problem is seen. i tried installing asp.net still same problem persist
maybe restarting IIS might help?