Avatar of ANAT2403
ANAT2403Flag for Israel

asked on 

error Cannot view XML input using style sheet.

I create a new website in asp.net 2.0 with one page containing a label.
I created a virtual directory for it in my comuter in inetpub\wwwroot.
I publish the website to that location and when I browse the default page I get the followinf error:

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'http://localhost/test2/Default.aspx'. Line 1, Positio...

This is a marker file generated by the precompilation tool, and should not be deleted!

What is the problem here?
Please help!!!
Web Languages and Standards

Avatar of undefined
Last Comment
Gertone (Geert Bormans)
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Hi ANAT2403,

It seems that you are giving a text file a text/xml mimetype
The browser assumes he is getting an XML file,
but what he gets is a text line
He is waiting for the XML declaration or a root XML tag

maybe your default is pointing to the wrong file,
or the XML you create isn't XML at all

Avatar of ANAT2403
Flag of Israel image


I repeat again:
I create a new website, add a new item default2.aspx and in it put a label.
That's it. I don't have any xml files. then I build the wesite and publish the the website to my computer
in Inetpub\wwwroot to a new folder I created and made it to be a virtual directory.
(this is all for testing before I do it with my real website).
Then in the explorer I write:
That's it I don't have any xml file. maybe the dot net create something.
I have the feeling that the problem is in the properties of the explorer but I don't know. Anyhow
I spend a lot of time on this . Do you know what is the problem?
I repeat again:
It seems that you are giving a text file a text/xml mimetype

it could be that this index page has a mime-type XML.
That is the setting you should be looking for
Avatar of ANAT2403
Flag of Israel image


Hi Gertone,
Sorry if I was a bit rude with the repeat but the thing is I just take the standart page without changing anything.
where is the mime-type  setting is given? I don't even know what it is?
Hope you can help me.
This is my page while the first 3 lines are given automatically. Is ther something I have to change there?
This is the first time I try to publish something.

%@ Page Language="C#" AutoEventWireup="true" CodeFile="def2.aspx.cs" Inherits="def2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Font-Size="XX-Large" Height="59px" Style="z-index: 100;
            left: 322px; position: absolute; top: 95px" Text="this is a test " Width="164px"></asp:Label>

%@ Page Language

I assume you dropped the "<" in copying the page
it should be "<%@ Page Language..." if that is not the case

you can try to set this page to single-file page model for a start

<%@ Page Language="C#" %>

I don't think you are using the CodeFiles yet

then you could set the ContentType in this header, like this

so your first line should be
<%@ Page ContentType="text/html" Language="C#" %>

hope this helps

Avatar of ANAT2403
Flag of Israel image


Hi Gertone,
I finally solve the problem in my compuer by the commands:
aspnet_regiis  -u  and then  aspnet_regiis -i. so I didn't need the text/html.
But now I have problems in running in the server.
I get the error :

The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'

In the users of the server do I have to have a user named ASPNET? because I don't have one. Is this the problem?
And if it is do I have to insert it myself or it has to be entered automatically?
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Web Languages and Standards
Web Languages and Standards

Web development can range from developing the simplest static single page of plain text to the most complex web-based internet applications, electronic businesses, and social network services using a wide variety of languages and standards, including the familiar HTML, JavaScript and jQuery, ASP and ASP.NET, PHP, ColdFusion, CSS, PHP, Flex and Flash, but also the implementation of a broad list of standards including XML, WSDL, SSDL, VoiceXML and many more.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo