html 页面及调用aspx页面中文乱码解决

有个向msn的弹出消息框

 

 

  footer.ascx.cs:

 

using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HotelManageService.Hotel;
using SupNumb.Constants.User;

 


public partial class com_Footer10 : System.Web.UI.UserControl
{
   

   
    protected void Page_Load(object sender, EventArgs e)
    {

       if (Session["CURRENTUSER"] != null)
        {
        
       
            HotelServiceUC uc = new HotelServiceUC();


            if (uc.NewestFailureTeleRightAlterList(Convert.ToInt32(((SupNumb.Constants.User.UserInfo)Session["CURRENTUSER"]).OwnerHotelId)) >= 1)
            {

                Response.WriteFile("../com/foot.html");
          }

       }


    }
}

 

foot.html:

 

<head>
  
 
  <meta http-equiv="content-type" content="text/html; charset=gb2312">
  
    </head>
  <script type="text/javascript" src="../j/div_goRight.js"></script>
  <script type="text/javascript">
  
 

  
 //设置每隔几秒访问一次数据库

 window.setInterval("checkNewMsg()", 10000);
 function checkNewMsg() {
  if (window.XMLHttpRequest) {
   req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
   req = new ActiveXObject("Microsoft.XMLHTTP");
  }

  req.open("post", "../fun/sysWebChat.aspx?method=sysWebChat_checkNewMSG", false);
  
  req.send();
  if (req.readyState == 4) {
   if (req.status == 200) {
    //成功!
    getDIV(req.responseText);
   }
  }
 }
 function getDIV(newmsg) {
  var MSG1 = new CLASS_MSN_MESSAGE("", 200, 120, "电话修改失败信息提示:",
    "的失败的电话权限修改信息,请浏览后对应重新修改!", newmsg
,
     "../system/TeleRightFailureAlter.aspx");
  MSG1.rect(null, null, null, screen.height - 10);
  MSG1.speed = 10;
  MSG1.step = 5;
  MSG1.show();
 }
</script>

 

问题:红色部分及TeleRightFailureAlter.aspx部分中文乱码

解决办法:Web.config配置文件的

<system.web>内加入<globalization 
            requestEncoding="gb2312" 
            responseEncoding="gb2312"
         />
且TeleRightFailureAlter.aspx文件的<%@ Page Language="C#"   MasterPageFile="~/main1.master"  AutoEventWireup="true"   CodeFile="TeleRightFailureAlter.aspx.cs" Inherits="system_TeleRightFailureAlter"  Title="最新电话权限修改失败列表"  ResponseEncoding="gb2312" %>加上ResponseEncoding="gb2312"

你可能感兴趣的:(html)