StevieB
StevieB

Reputation: 6523

ASP.NET XML Parsing Error: no element found Line Number 1, Column 1 Error

Hey I found a weird temperamental page which randomly gives me the following error

XML Parsing Error: no element found
Location: http://kj2011/site_2011/nonprofit-database/overview.aspx
Line Number 1, Column 1:

This page was fine for like 2 weeks but as of yesterday I randomly get the above error. I was to delete the pages and recreate the error is gone but would come back again few hours later. I have some other templates

i.e http://kj2011/site_2011/nonprofit-database/financial.aspx

Which has the same Master File and User Controls but never gets the error just the overview.aspx page.

Any Ideas ?

Upvotes: 11

Views: 52036

Answers (12)

Linfeng Mu
Linfeng Mu

Reputation: 179

I met the same problem, in my case, I lost a ';' in a syntax.

Upvotes: 0

Charl Rome
Charl Rome

Reputation: 11

In my case it was the AjaxControlToolkit.dll that was missing from the bin folder. Adding a breakpoint in the Application_Error method in global.asax as suggested above allowed me to find this out.

Upvotes: 1

Hadi Orakzai
Hadi Orakzai

Reputation: 11

some time This type of error occurs when you have app_offline.html file in your directory.When ASP.Net found a file names app_offline.htm in the root of a web application directory, it shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application. ASP.NET also then respond to all requests for dynamic pages in the application by sending back the content of the app_offline.htm file. The default content is an error message.

Upvotes: 1

Albert Vives
Albert Vives

Reputation: 11

Just to cover all the possibilities. Today I got the same error, no matter the page I was trying to access, but it was a completelly unrelated issue.

For some reason, Skype loaded before IIS on Windows startup and took control of port 80, instead of the usual 17112. Whenever I tried to access a page Skype returned an empty response.

You can simply shut down Skype and reset IIS, but to make sure it never happens again do the following:

Go to:

Skype > Tools > Options > Advanced > Connection

And uncheck Use port 80 and 443 as alternative for incomming connections

Upvotes: 1

Walter Stabosz
Walter Stabosz

Reputation: 7735

I just debugged this issue on my website. In my case, the cause was a call to Response.End() . You can recreate the error by dropping Response.End() as the first line of Page_Load.

From MSDN ms524629:

The Response.End method causes the Web server to stop processing the script and return the current result. The remaining contents of the file are not processed.

In my case, Response.End() was being called before any content was written to the buffer. Also, there was no Content-Type in the response header (see attached Firebug screen grabs). My guess is because of these two factors, Firefox didn't know what to make of it and by default it tried to process it as a an XML file.

In your situation, my guess is the extra View.aspx file caused an exception that was interrupting page rendering cycle.

https://i.sstatic.net/wpLrt.png

https://i.sstatic.net/LE59C.png

Upvotes: 3

Chani Poz
Chani Poz

Reputation: 1463

When the rewrite of the url in web.config has a problem - the browser send 404 error. Try to comment all the rules and check again if the 404 error arise.

Upvotes: 1

tmc
tmc

Reputation: 324

To find the issue you are having with this problem.

In your global.asax file add:

void Application_Error(object sender, EventArgs e)
{
    Exception objErr = Server.GetLastError().GetBaseException();
    string err =    "Error caught in Application_Error event" +                
            "\n \nError Message: " + objErr.Message.ToString()+ 
            "\n \nStack Trace: " + objErr.StackTrace.ToString();

       System.Diagnostics.EventLog.WriteEntry("MYApplication", err, System.Diagnostics.EventLogEntryType.Error);
    Server.ClearError();     
} 

You can set a break point here or log this message into an EventLog.

Upvotes: 4

MichaelBolton
MichaelBolton

Reputation: 84

App_Themes folder was missing when I got this.

Upvotes: -1

trailmax
trailmax

Reputation: 35106

Just for the future reference, in case people come here from google

According to this thread, there are many different reasons to get this error. In my case this caused by overriding override void Render(System.Web.UI.HtmlTextWriter writer)

and I have not called base.Render(writer); at the end of overridden function.

Upvotes: 2

StevieB
StevieB

Reputation: 6523

This was an issue with an external DLL, which created a page called view.aspx in the same folder which caused an issue with our overview.aspx. We just renamed the page and the issue went away.

Upvotes: 1

MK.
MK.

Reputation: 5149

The most likely cause for such problem is security, if the problem occurs! check file security and make sure its accessible by asp.net process. (ASP.NET Required Access Control Lists (ACLs)), also does this occur with local calls on the same server?

Another thing is to check your page and make sure you don't have one or more unclosed tags in your markup.

Upvotes: 3

jbgoode
jbgoode

Reputation: 355

That sounds like the Firefox error page that's returned when FF expects HTML and gets an empty document instead. Try looking at it with Firebug enabled and see what the Net tab says - perhaps you have a good header, but no html.

Usually that kind of thing is not due to an ASP.NET error (since with those you still have a document body for the Yellow Screen of Death page), but is more along the lines of a networking error...

Would it be possible to try looking at it from another computer to see if that's the problem?

Upvotes: 22

Related Questions