XML-parser error: no element found - c#

I have a asp.net application which is located on a server.
It was working but then I added a whole bunch of stuff and now I get:
XML-parser error: no element found
Address: http://www.dtm.se/payex/Default.aspx
Row 1, Column 1:
(I have translated this error message from Swedish so it might not be 100% accurate)
The error occurs in Firefox when I upload the code to "my" site.
In IE 8 and Google Chrome I get blank pages.
When I compile it it locally it runs without issues.
I have set up IIS (7.0) on my machine and it works there to.
I have checked the files on the server just in case there was something wrong with the upload but the code was there.
I also have tried to remove the code I have added to see if I can get it to work again.
But no. Of course I am not 100% sure I got everything back to the way it was.
It doesn't matter which file I am trying to load all of them get this error message.
Hmm, when I write this I get the feeling it might be something wrong with the way the asp.net application i set up on the server.
But since it worked from the beginning...
There is a lot of code so I don't know really what to upload here but maybe someone recognize this error message and knows what it is or maybe point me in the right direction.

Your Default.aspx page appears to have the following output:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
</body>
</html>
It appears that Firefox assumes this to be an XML document (with no data) and throws an error in this case (Maybe something to do with the DOCTYPE). It is also possible that .NET generates a response type of "application/xml" in this case, though I cannot confirm that. IE 7 shows a blank page as expected.
What you should look into is why your page is giving blank output. Are you sure that the site is configured to run with the correct version of ASP.NET?

The error was that I was using MySql and when I added the reference to the connector it added a line in web.config, but it didn't add the dll in the bin folder.
So when the server tried to access the file it thru this error.
So I added the file manually to the bin folder and, tada, it started working.
I disinctly remember VisualStudio adding the files when I choose add reference.
But maybe I had it mixed up with something else.

Related

AjaxControlToolkit - asp:HtmlEditorExtender problem with Chrome

I have a problem with Chrome only(with IE and Firefox the page works fine), in aspx page that uses "asp:HtmlEditorExtender" tag and the ajaxcontroltoolkit assembly is included.
The error message on the Chrome console is :
Uncaught DOMException: Failed to execute 'collapse' on 'Selection': There is no child at offset 3.
and the line of js code indicated is the following:
sel.collapse(this._editableDiv.firstChild, char);
I follow the workaround suggested in this link:
http://guerriandrea.blogspot.com/2015/01/problem-between-chrome-and.html
but the problem remains when saving the formatted content within the text area; the error remains client.
I tried to update the ajaxcontroltoolkit library and the bug doesn't show up ... the problem is that I would like to avoid updating this library as it is used by almost every page of my application and I would have to test all the functions again.
Thank you very much

CSS file updates don't apply in ASP .NET CORE

I have a CSS file for my homepage, it's just a simple transparent background image.
When I change something in that file, it does not apply the changes, older version is compiled.
Even if delete that file completely from computer, it still loads it (I saw that within inspect element).
My view has just link to that CSS file and nothing else. It has defined Layout page also.
It's happening to me all the time. If I create some other as source, it works but I get the same problem for that new file also after the initial version.
What could itbe ? I'm fairly new in ASP .NET CORE but it looks like it's storing those files in a server. One time I accidentally opened console in inspect element and got some bad connection error and it worked from that point on.
Sounds like your browser is caching your css file. A common way to force it to use the updated version is to add the attribute asp-append-version="true" to all your link and script tags so that your browser always fetches the most up to date version.

Published .aspx only shows plain html

Today i made a quick template for a landingpage and wanted to test it on my webhotel. I have never actually published a website on a webhotel before, but the initial process in asp.net was pretty flawless.
The way i got my webpage onto the server, was by publishing my project and transferring it to my server on a FTP connection.
However, when i open my up my webpage, it only shows the html code, which is really weird. .
http://bkrt.dk/Index.aspx
What may i have done wrong, and How do i solve this issue?
Turns out that my webhotel doesnt support .aspx, but only php!
- Solution is that i either change webhotel, or do a full convertion to html, which seems to be no option. I will therefore look for a webhotel with asp.net support.

Visual Studio, Hundreds of bogus error messages, all on line 1 of apsx file

In Visual Studio 14.0.24720.00 Update 1, I have a solution with a single ASP.NET C# project. When I try to compile, I get 281 errors, all on line 1. This happens frequently, sometimes with close to 1,000 errors, but in the past there has always been at least one actual error somewhere in the list, identifiable by a line number other than 1, and when it was removed all the other messages would go away too. (Sometimes I had to re-compile twice.) In this case, all 281 error are supposedly on line 1, and none of them seem to be valid errors.
Here are the first 4 lines of the .ASPX file:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="PrintRaces.aspx.cs" Inherits="iVoterGuide.com.Print.PrintRaces" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
And here is a sample of the error messages, chosen because this section has more different messages than most:
The first few errors are all 'Newline in constant,' 'Too many characters in character literal,' or 'Empty character literal.' I cannot find any character literals in my code. From memory of other instances, I think there are the three most frequent messages and they usually head the list.
In this case, the file is a newly created .ASPX file with C# code-behind. There is no master page and I removed all scripts, CSS, and includes, with no change in the result.
Can someone suggest a cause or way of diagnosing the problem? Thanks so much.
EDIT: It seems clear that some VB code is accidentally being compiled by the c# compiler, but where does it come from and why do the errors go away when errors are removed from the c# code?
All the error messages point to the fact that you have VB code when it is expecting C#. As and End are VB keywords while your ASPX page says it's C# and the code behind file is a .cs file which is a C# file.
I'm not sure if this really counts as an answer, but the problem is gone. There was a missing } at the end of the c# file. When I fixed that, all the messages went away.

Can using server-side scripting delimiters (<% %>) cause compilations during runtime?

I am occasionally getting "Application compilation is starting." event in my Event Log and I can't identify what's causing it. I think I may try this - http://blogs.msdn.com/b/tess/archive/2008/11/06/troubleshooting-appdomain-restarts-and-other-issues-with-etw-tracing.aspx - but before I do that I was curious if I can identify the problem without starting to mess with something unknown.
I have used <%= %> and <%# %> tags throughout the app so I am wondering if this is what's causing the problems. On couple spots I have embedded C# code (using ) so that may add to it?
Precompiling the app is also valid choice for me, I just don't want to end in position in which I need execute precompilation command on the server every time I upload some changes to the server. Currently on my dev machine I've followed advices from this link - http://mikehadlow.blogspot.com/2008/05/compiling-aspx-templates-using.html - and it does awesome job as it allows me to identify errors in C# code in .aspx pages during build in Visual Studio. However, I presume precompilation results are not stored in my website directory (and won't be published when I use Publish option).
Ideally, I want to stay in position I am with default Web Application model with addition of automatically running compilation as soon as I upload changed .aspx or .ascx over FTP (not waiting for user's http request). Am I asking too much, or is this possible to setup?
From my research it seems it can.
Because nobody responded I'll accept this as answer.

Categories