내 웹 페이지에서 일부 XML 코드를 변환하려고했습니다. 그래서 json.net을 사용하려고했습니다. 문자열을 표시하려고 할 때까지 모두 잘 돌아갔습니다. 안녕하세요.ASP.NET json.Net xml to json
public partial class json : System.Web.UI.Page
{
public class Account
{
public string Name { get; set; }
public string Email { get; set; }
public DateTime DOB { get; set; }
}
public void Page_Load(object sender, EventArgs e)
{
Account account = new Account
{
Name = "John Doe",
Email = "[email protected]",
DOB = new DateTime(1980, 2, 20, 0, 0, 0, DateTimeKind.Utc),
};
string hello = JsonConvert.SerializeObject(account, Formatting.Indented);
}
}
aspx.cs 그리고 내 영문 사이트는 다음과 같습니다 : 내 aspx.cs 사이트는 다음과 같습니다.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="json.aspx.cs" Inherits="json" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div><% = this.hello %></div>
</form>
</body>
</html>
"hello"문자열을 사용할 수있는 방법은 무엇입니까? 당신은 안녕하세요 변수에 대한 액세스 권한이없는 D
당신이 얻을 오류 또는 예외가 무엇인가를 호출 할 수 있습니다? –
심각도 \t 코드 \t 설명 \t 프로젝트 CS1061 'json_aspx이'안녕하세요 '에 대한 정의와 유형'json_aspx '의 첫 번째 인수를 받아들이는 확장자가없는 방법을'안녕하세요 '가 포함되어 있지 않습니다 \t \t 파일 \t 라인 \t 억제 상태 오류 볼 수 있습니다 (사용 지시문이나 어셈블리 참조가 누락 되었습니까?) \t json – Doggo