Error on line 2 at column 2 starttag invalid element name

User1632842107 posted
  • Remove From My Forums
  • Question

  • User1632842107 posted

    I connect my aspx page from html by ‘href‘ link. My index page is in
    .html extension and my Login page in .aspx extension.

    When i run my Web pages without debug(Ctrl + F5) from Visual Studio it
    works fine
    and i don’t get this error
    «Error on line 1 at column 2: StartTag: invalid element name»
    .

    When i open my Index.html file form local directory and Click on Login button i got this error. 

    I don’t think so there is any issue in my Web.Config becoz it work fine by Ctrl+F5.

    Thanks, for help in advance.

Answers

  • User475983607 posted

    Host123

    From Visual Studio it works fine. When I view (Ctrl+shift+W) default.html from Visual Studio and click on LogIn button, it redirect me at Login.aspx. 

    But when I open default.html from local directory it shows this Error: «StartTag: invalid element name». 

    I just want to know, its due to HTML files do not trigger the ASP.NET as you mention early?

    You misunderstand how ASP.NET works at a fundamental level.  ASP.NET is a server side framework where ASPX page are hosted in IIS/ASP.NET services.  The pages are processed on the server and the results is an HTML stream to the browser.  You
    can’t open an ASPX page from the file system with a browser because there’s not HTTP pipeline.  The browser thinks the file is XML and shows the error.  This is considered common knowledge.  

    Host123

    Btw i can show the working file from Visual Studio but i am just afraid what if He ask me to open it from Local Directory.

    I suspect the interviewer would not ask this question because it is an odd thing to do.   I started with Web Forms back the early 2000s and today is the first time I’ve ever tried to open an ASPX file with a browser.  It’s never crossed my
    mind.

    However, the fact that you are asking this question indicates you have never written an ASP.NET application.

    Use Visual Studio to run the web application by pressing F5 or clicking the run button in the toolbar.

    • Marked as answer by

      Thursday, October 7, 2021 12:00 AM

(Предупреждение — новичок asp) У меня есть файл aspx с тегом

    <%@ Page Language=VB  ... %>

В самом начале файла.

При вызове этого с моего сервера IIS (http: //localhost/myservice/default.aspx) это дает мне ошибку

This page contains the following
errors:

error on line 1 at column 2:
StartTag: invalid element name
Below is a rendering of the page up to
the first error.

Что я делаю не так?

Перейти к ответу
Данный вопрос помечен как решенный


Ответы
7

Создается впечатление, что браузер пытается отобразить то, что, по его мнению, является файлом XML, поскольку выдает ошибку на втором символе первой строки. Поэтому я думаю, что файл не анализируется, а просто немедленно возвращается как есть. Убедитесь, что ваш сервер IIS настроен правильно и действительно ли он анализирует ваши теги ASP перед возвратом страницы.

Когда я перешел на вкладку ASP.NET для виртуального каталога, я заметил, что версия ASP.NET не была выбрана (это было пустое поле со списком). Выбор версии .NET framework сделал свое дело. Спасибо.

Как и в предыдущем комментарии, в моей настройке тоже не была выбрана версия ASP.NET. Но после выбора версии я получил следующую ошибку при доступе к файлу aspx.
Windows XP, IIS 5.1.
Сведения об исключении: System.Web.Hosting.HostingEnvironmentException: не удалось получить доступ к метабазе IIS.

Выполнил следующие команды, aspnet_iis -i
и aspnet_iis -ga

Решил проблему.

Когда я это сделал. Работало нормально.

Перейдите в эту директорию в командной строке C: WINDOWS Microsoft.NET Framework v2.0.50727
Запустите эту команду
Aspnet_regiis -I

Это установит aspnet

Попробуй это :

Чтобы установить и включить ASP.NET:

Щелкните Пуск, а затем щелкните Панель управления.
Щелкните «Установка и удаление программ».
Щелкните Добавить / удалить компоненты Windows.
Дважды щелкните Сервер приложений, а затем щелкните Подробности.
Установите флажок ASP.NET и нажмите кнопку ОК.
Нажмите «Далее.
Щелкните Готово.

Для меня проблема заключалась в том, что я просматривал файл .svc, используя свой локальный путь к файлу, сопоставленный с сервером в моем браузере, когда я хотел использовать дословный путь к моему серверу.

Для меня проблема заключалась в сериализации, которая отвечала клиенту.

Моя проблема заключалась в пространствах тегов xml:

  - < tag > text < / tag >  ---> wrong

  - <tag> text </tag> ----> good.

Другие вопросы по теме

@c-x,

Looking at what you’ve described so far, I’m having a bit of trouble figuring out how callTaxiiService2 would be where the code is failing.

First, you mention StartTag: invalid element name, line 555, column 2, which has a few hints:

  • The invalid element name is an XML parse error, and the code you show does not attempt to parse XML until the line that reads taxii_message = t.get_message_from_http_response(resp, poll_req.message_id)
  • The error location is line 555, column 2, which seems to indicate that the error is in a Poll Response. TAXII Poll Requests like the one the above code creates are only a few lines (maybe 10-15 if you pretty print it). If the error is in fact in a Poll Response, that means you are getting a response from the server.

Second, you mention that the error occurs when libtaxii is processing an addinfourl object. addinfourl objects are returned by callTaxiiService2 (specifically libtaxii’s underlying use of urllib2.urlopen), which leads me to think that the callTaxiiService2 returned successfully. If that function failed, I do not have an explanation as to how you’d have a handle on the return object.

The t.get_message_from_http_response(resp, poll_req.message_id) line parses XML from the HTTP Response (encapsulated in an addinfourl object) [1] [2].

I can replicate the error you are getting with the following code (note the extraneous begin bracket <):

from lxml import etree
etree.XML('<hello><</hello>')
# Traceback (most recent call last):
#  File "<stdin>", line 1, in <module>
#  File "lxml.etree.pyx", line 3072, in lxml.etree.XML (srclxmllxml.etree.c:70460)
#  File "parser.pxi", line 1828, in lxml.etree._parseMemoryDocument (srclxmllxml.etree.c:106689)
#  File "parser.pxi", line 1716, in lxml.etree._parseDoc (srclxmllxml.etree.c:105478)
#  File "parser.pxi", line 1086, in lxml.etree._BaseParser._parseDoc (srclxmllxml.etree.c:100105)
#  File "parser.pxi", line 580, in lxml.etree._ParserContext._handleParseResultDoc (srclxmllxml.etree.c:94543)
#  File "parser.pxi", line 690, in lxml.etree._handleParseResult (srclxmllxml.etree.c:96003)
#  File "parser.pxi", line 620, in lxml.etree._raiseParseError (srclxmllxml.etree.c:95050)
# lxml.etree.XMLSyntaxError: StartTag: invalid element name, line 1, column 9

Based on that, my bet is that the STIX content in the Poll Response has an extra begin bracket (therefore being invalid XML) and that’s what’s blowing up.

As @gtback mentioned to me offline, libtaxii can do a much better job of handling processing errors. So regardless of this issue’s resolution, I’ll open an issue for that.

@c-x — I don’t mean to disagree too much, but I’m having trouble arriving at your conclusion with the evidence you’ve provided. I’ve attempted to explain my thought process so that we can reach a conclusion about what’s happening and the best way to fix it. I realize I’m not coming from the debug logs (like you are), but rather an understanding of the code, so I may be missing a key piece of information.

Thank you.
-Mark

[1] https://github.com/TAXIIProject/libtaxii/blob/master/libtaxii/__init__.py#L96
[2] https://github.com/TAXIIProject/libtaxii/blob/master/libtaxii/messages_11.py#L87

Содержание

  1. Error on line 1 at column 2 starttag invalid element name
  2. Host123
  3. Error on line 1 at column 2 starttag invalid element name
  4. Host123
  5. Error on line 1 at column 2 starttag invalid element name
  6. Answered by:
  7. Question
  8. This page contains the following errors:
  9. Below is a rendering of the page up to the first error.
  10. Error on line 1 at column 2 starttag invalid element name
  11. Host123
  12. «StartTag: недопустимое имя элемента» в default.aspx

Error on line 1 at column 2 starttag invalid element name

From Visual Studio it works fine. When I view (Ctrl+shift+W) default.html from Visual Studio and click on LogIn button, it redirect me at Login.aspx.

But when I open default.html from local directory it shows this Error: «StartTag: invalid element name».

I just want to know, its due to HTML files do not trigger the ASP.NET as you mention early?

You misunderstand how ASP.NET works at a fundamental level. ASP.NET is a server side framework where ASPX page are hosted in IIS/ASP.NET services. The pages are processed on the server and the results is an HTML stream to the browser. You can’t open an ASPX page from the file system with a browser because there’s not HTTP pipeline. The browser thinks the file is XML and shows the error. This is considered common knowledge.

Host123

Btw i can show the working file from Visual Studio but i am just afraid what if He ask me to open it from Local Directory.

I suspect the interviewer would not ask this question because it is an odd thing to do. I started with Web Forms back the early 2000s and today is the first time I’ve ever tried to open an ASPX file with a browser. It’s never crossed my mind.

However, the fact that you are asking this question indicates you have never written an ASP.NET application.

Use Visual Studio to run the web application by pressing F5 or clicking the run button in the toolbar.

Источник

Error on line 1 at column 2 starttag invalid element name

From Visual Studio it works fine. When I view (Ctrl+shift+W) default.html from Visual Studio and click on LogIn button, it redirect me at Login.aspx.

But when I open default.html from local directory it shows this Error: «StartTag: invalid element name».

I just want to know, its due to HTML files do not trigger the ASP.NET as you mention early?

You misunderstand how ASP.NET works at a fundamental level. ASP.NET is a server side framework where ASPX page are hosted in IIS/ASP.NET services. The pages are processed on the server and the results is an HTML stream to the browser. You can’t open an ASPX page from the file system with a browser because there’s not HTTP pipeline. The browser thinks the file is XML and shows the error. This is considered common knowledge.

Host123

Btw i can show the working file from Visual Studio but i am just afraid what if He ask me to open it from Local Directory.

I suspect the interviewer would not ask this question because it is an odd thing to do. I started with Web Forms back the early 2000s and today is the first time I’ve ever tried to open an ASPX file with a browser. It’s never crossed my mind.

However, the fact that you are asking this question indicates you have never written an ASP.NET application.

Use Visual Studio to run the web application by pressing F5 or clicking the run button in the toolbar.

Источник

Error on line 1 at column 2 starttag invalid element name

Answered by:

Question

hi I published my visual studio 2010 website program

and when i try to access it, I’m getting theis error:

This page contains the following errors:

Below is a rendering of the page up to the first error.

I’ve tried evrything written on

but nothing happens

note: My code is compiling in visual studio 2010 it just not work when I published it.

Pls check my code I might just overlook it.

here’s my default.aspx

SelectCommand=»SELECT ID,FirstName,MiddleName,LastName,Position,(convert(varchar(10), birthday, 120)) as Birthday,(convert(varchar(10), datehired,120)) as Datehired,Status FROM tblperson»
DeleteCommand=»Delete from tblperson where [ID]=@ID»
UpdateCommand=»UPDATE tblperson SET [FirstName]=@FirstName,[MiddleName]=@MiddleName,[LastName]=@LastName,[Position]=@Position,[Birthday]=@Birthday,[DateHired]=@DateHired,[Status]=@Status WHERE [ID]=@ID»
>

Источник

Error on line 1 at column 2 starttag invalid element name

From Visual Studio it works fine. When I view (Ctrl+shift+W) default.html from Visual Studio and click on LogIn button, it redirect me at Login.aspx.

But when I open default.html from local directory it shows this Error: «StartTag: invalid element name».

I just want to know, its due to HTML files do not trigger the ASP.NET as you mention early?

You misunderstand how ASP.NET works at a fundamental level. ASP.NET is a server side framework where ASPX page are hosted in IIS/ASP.NET services. The pages are processed on the server and the results is an HTML stream to the browser. You can’t open an ASPX page from the file system with a browser because there’s not HTTP pipeline. The browser thinks the file is XML and shows the error. This is considered common knowledge.

Host123

Btw i can show the working file from Visual Studio but i am just afraid what if He ask me to open it from Local Directory.

I suspect the interviewer would not ask this question because it is an odd thing to do. I started with Web Forms back the early 2000s and today is the first time I’ve ever tried to open an ASPX file with a browser. It’s never crossed my mind.

However, the fact that you are asking this question indicates you have never written an ASP.NET application.

Use Visual Studio to run the web application by pressing F5 or clicking the run button in the toolbar.

Источник

«StartTag: недопустимое имя элемента» в default.aspx

(Предупреждение — новичок asp) У меня есть файл aspx с тегом

в самом начале файла.

При вызове этого с моего сервера IIS (http: //localhost/myservice/default.aspx) это дает мне ошибку

This page contains the following errors:

error on line 1 at column 2: StartTag: invalid element name
Below is a rendering of the page up to the first error.

Что я делаю не так?

не забудьте добавить расширение .asmx к сопоставлениям приложений .

Создается впечатление, что браузер пытается отобразить то, что, по его мнению, является файлом XML, поскольку выдает ошибку на втором символе первой строки. Поэтому я думаю, что файл не анализируется, а просто немедленно возвращается как есть. Убедитесь, что ваш сервер IIS настроен правильно и действительно ли он анализирует ваши теги ASP перед возвратом страницы.

Да, похоже, что ASP.NET неправильно установлен в IIS. Если вы можете отлаживать эту страницу в VS, то это определенно проблема.

Когда я перешел на вкладку ASP.NET для виртуального каталога, я заметил, что версия ASP.NET не была выбрана (это было пустое поле со списком). Выбор версии .NET framework сделал свое дело. Спасибо.

Как и в предыдущем комментарии, в моей настройке тоже не была выбрана версия ASP.NET. Но после выбора версии я получил следующую ошибку при доступе к файлу aspx. Windows XP, IIS 5.1. Сведения об исключении: System.Web.Hosting.HostingEnvironmentException: не удалось получить доступ к метабазе IIS.

Выполнил следующие команды, aspnet_iis -i и aspnet_iis -ga

Источник

Понравилась статья? Поделить с друзьями:
  • Error on line 1 at column 39 extra content at the end of the document
  • Error loading image mta
  • Error on ingesting samples with different value but same timestamp
  • Error lcd was not declared in this scope
  • Error of failed request badaccess attempt to access private resource denied