谁可以告诉我,asp.net怎么调用java 的 jsp 然后获得返回的xml啊,谢谢,大家了
解决方案 »
- 一个简单的httpd.ini该怎么来写呀,谢谢了.
- Web自定义控件问题
- 两到超难的面试题,清家当产求答案,一个设计模式的,一个存储过程.
- 求助关于数据库连接问题
- AspNetPager怎么就是不翻页呢,现在很着急啊
- 个人对三层架构的简单理解,欢迎大家参予指正。
- 为什么我在页面中加入一个IMAGEBUTTON后,一点儿击后会先新开一个和原页面一样的页面,我没有做任何程序?
- 错误求解
- 100高分 在线等 MySql导出二进制流数据 全是乱码 大家帮帮我吧 急啊!!!!!!!!!!!!!!!!!!!
- 为什么装不到呀、
- 关于DataGridView的RowEnter事件的使用
- 如何在一个方法中弹出像js confirm一样的对话框,提示用户是否继续。。
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" Height="293px"
Width="430px"></asp:TextBox>
<br />
<asp:Button ID="btn" runat="server" Text="Get XML" onclick="btn_Click" />
</form>
</body>
</html>using System.Net;
using System.IO;protected void btn_Click(object sender, EventArgs e)
{
string uid = "阿非", pwd = "Sandy"; WebRequest request = WebRequest.Create(string.Format("http://localhost:13655/WebSiteTest1/WebRequest/ResponseXML.aspx?uid={0}&pwd={1}", Server.UrlEncode(uid), pwd)); request.Method = "Get"; WebResponse response = request.GetResponse(); Stream stream; if (response != null && (stream = response.GetResponseStream()) != null)
{
StreamReader sr = new StreamReader(stream, System.Text.Encoding.UTF8); txtContent.Text = sr.ReadToEnd();
} }
下面就等于jsp文件ResponseXML.aspx.csprotected void Page_Load(object sender, EventArgs e)
{
StringBuilder xmlData = new StringBuilder();
xmlData.AppendLine(@"<?xml version='1.0' encoding='UTF-8' ?>");
xmlData.AppendLine(@"<root>");
xmlData.AppendLine(string.Format("<uid>{0}</uid>", Request.QueryString["uid"]));
xmlData.AppendLine(string.Format("<pwd>{0}</pwd>", Request.QueryString["pwd"]));
xmlData.AppendLine(@"</root>"); Response.Clear();
Response.Write(xmlData.ToString());
Response.End();
}