跪求各位大虾,有个问题困扰了我n天了,就是后台服务端和前台的交互

melodylee 2004-12-28 04:35:02
我这里先有礼了
我有一个框架
有两个页面组成
<head>
<TITLE>页脚框架集</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</head>
<frameset rows="*,64">
<frame name="main" src="">
<frame name="footer" src="WebForm1.aspx" noResize scrolling="no">
<noframes>
<pre id="p2">

部分代码如上,一个页面是main另一个是footer
我想点击webForm1.aspx上一个按钮,并且在这个页面中保留一个Session变量,这个变
量是字符串型,这个字符串存储的是一个url地址
我想点击这个按钮的时候就用这个地址刷新frame名字main的那个页面
webform1.aspx页面的html代码是
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="SendArcXML.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title></title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<script language="javascript">
fuction confirmSubmit()
{


}//我主要是不会写这段script代码
我不知道怎么写,怎么去实现刷新那个另外一个页面,用一个Session变量存储的URL地址
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 16px" runat="server"> ArcIMS服务器名称
</asp:label><asp:textbox id="ArcIMSServerText" style="Z-INDEX: 102; LEFT:
168px; POSITION: absolute; TOP: 16px"
runat="server">localhost</asp:textbox><asp:button
id="GetServicesButton" style="Z-INDEX: 103; LEFT: 344px; POSITION:
absolute; TOP: 16px"
runat="server" Text="获取服务"></asp:button><asp:label
id="ServiceNameLabel" style="Z-INDEX: 104; LEFT: 440px; POSITION: absolute;
TOP: 16px"
runat="server" Visible="False"> 服务名称</asp:label><asp:dropdownlist
id="ServiceDDList" style="Z-INDEX: 105; LEFT: 528px; POSITION: absolute;
TOP: 16px"
runat="server" Visible="False"
Width="120px"></asp:dropdownlist><asp:button id="ConfirmServiceButton"
style="Z-INDEX: 106; LEFT: 672px; POSITION: absolute; TOP: 16px"
runat="server" Text="确定" Visible="False"></asp:button></FONT></form>
</body>
</HTML>
webform1.aspx的后台是
后台代码是
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;

namespace SendArcXML
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox ArcIMSServerText;
protected System.Web.UI.WebControls.Button GetServicesButton;
protected System.Web.UI.WebControls.Label ServiceNameLabel;
protected System.Web.UI.WebControls.DropDownList ServiceDDList;
protected System.Web.UI.WebControls.Button ConfirmServiceButton;



private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
ConfirmServiceButton.Attributes.Add("onClick", "return confirmSubmit();");//在这里我想绑定我想在Script里面写的方法,只要一点击,就运行那个函数

}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.GetServicesButton.Click += new System.EventHandler(this.GetServicesButton_Click);
this.ServiceDDList.SelectedIndexChanged += new System.EventHandler(this.ServiceDDList_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion



private void GetServicesButton_Click(object sender, System.EventArgs e)
{
try
{
localhost.ArcXML_Web_Service getReturnArcXML = new localhost.ArcXML_Web_Service();
string returnedArcXML = getReturnArcXML.sendMyArcXML("<GETCLIENTSERVICES/>", ArcIMSServerText.Text,"catalog","");
ArrayList theArrayList = new ArrayList();
int theEnd = 0;
string theService;
int theStart=returnedArcXML.IndexOf("SERVICE");
while (theStart > -1)
{
theStart = returnedArcXML.IndexOf("SERVICE name=",theEnd) + 14;
if (theStart < theEnd) break;
theEnd = returnedArcXML.IndexOf("servicegroup",theStart) - 2;
theService = returnedArcXML.Substring(theStart,theEnd - theStart);
theArrayList.Add(theService);
}
ServiceNameLabel.Visible = Boolean.Parse("True");
ServiceNameLabel.Text = "服务名称";
theArrayList.Sort();

;

ServiceDDList.Visible = Boolean.Parse("True");
ServiceDDList.Items.Clear();
ServiceDDList.DataSource = theArrayList;
ServiceDDList.DataBind();
ConfirmServiceButton.Visible = Boolean.Parse("True");




}
catch
{
ServiceDDList.Visible = Boolean.Parse("False");
ConfirmServiceButton.Visible = Boolean.Parse("False");
ServiceNameLabel.Visible = Boolean.Parse("True");
ServiceNameLabel.Text = "没有发现服务或者服务器名称出现错误";
}
}

private void ServiceDDList_SelectedIndexChanged(object sender, System.EventArgs e)
{
string hostname,ServiceObjectName;
hostname = ArcIMSServerText.Text.ToString();
ServiceObjectName = ServiceDDList.SelectedItem.Text.ToString();
string str = "http://"+hostname+"/Website/"+ServiceObjectName+"/frame.htm";
Session["strurl"] = str;//我在这里设置了一个Session变量负责为刷新另外一个页面提供一个url地址

}





}
}
...全文
190 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
Davidnetlee 2005-01-05
  • 打赏
  • 举报
回复
关注你很久了
melodylee 2005-01-05
  • 打赏
  • 举报
回复
现在还没有搞定呀,现在不报错了,而是就是出不来那个页面,上面的那个frame.main里面显示的找不到页面 您无权查看该网页
您可能没有权限用您提供的凭据查看此目录或网页。

--------------------------------------------------------------------------------

如果您确信能够查看该目录或网页,请尝试使用localhost主页上所列的电子邮件地址或电话与网站联系。

可以单击搜索,寻找 Internet 上的信息。




HTTP 错误 403 - 禁止访问
Internet Explorer


再请各位大虾帮忙呀
leizy 2005-01-05
  • 打赏
  • 举报
回复
问题解决了吗?
qwjcool 2004-12-29
  • 打赏
  • 举报
回复
up
posemanboy 2004-12-29
  • 打赏
  • 举报
回复
我的实现左页面点击,右边页面刷新的代码,在。cs里面写,看能否对你有用:
Response.Write("<script language=\"javascript\">window.parent.frames(\"right\").document.location.href =\"MailRecord.aspx?ProjectCondition="+Server.UrlEncode(EncodeBase64("gb2312",Condition))+"\";</script>");

welshem 2004-12-29
  • 打赏
  • 举报
回复
<script language="javascript">
fuction confirmSubmit(url) <<<<<<<fuction应改为function
{
window.parent.frames(0).location.replace(url);
return false;
}
</script>

melodylee 2004-12-29
  • 打赏
  • 举报
回复
其实我直接用Http地址可以访问那个传过来的网址
melodylee 2004-12-29
  • 打赏
  • 举报
回复
在需要刷新的页面显示如下信息
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>

<head>
<style>
a:link {font:9pt/12pt 宋体, MS Song; color:red}
a:visited {font:9pt/12pt 宋体, MS Song; color:#4e4e4e}
</style>
<meta HTTP-EQUIV="Content-Type" Content="text-html; charset=gb2312">
<title>HTTP 403 (禁止访问)</title>
</head>
<script>
function Homepage(){

// in real bits, urls get returned to our script like this:
// res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm

//For testing use DocURL = "res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm"
DocURL=document.location.href;

//this is where the http or https will be, as found by searching for :// but skipping the res://
protocolIndex=DocURL.indexOf("://",4);

//this finds the ending slash for the domain server
serverIndex=DocURL.indexOf("/",protocolIndex + 3);

//for the href, we need a valid URL to the domain. We search for the # symbol to find the begining
//of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker.
//urlresult=DocURL.substring(protocolIndex - 4,serverIndex);
BeginURL=DocURL.indexOf("#",1) + 1;
urlresult=DocURL.substring(BeginURL,serverIndex);
if (protocolIndex - BeginURL > 7)
urlresult=""

//for display, we need to skip after http://, and go to the next slash
displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);

// Security precaution: must filter out "urlResult" and "displayresult"
forbiddenChars = new RegExp("[<>\'\"]", "g"); // Global search/replace
urlresult = urlresult.replace(forbiddenChars, "");
displayresult = displayresult.replace(forbiddenChars, "");

document.write('<A target=_top HREF="' + urlresult + '">' + displayresult + "</a>");
}

function doSearch()
{
saOC.NavigateToDefaultSearch();
}

function initPage()
{
document.body.insertAdjacentHTML("afterBegin","<object id=saOC CLASSID='clsid:B45FF030-4447-11D2-85DE-00C04FA35C89' HEIGHT=0 width=0></object>");
}

</script>


<body bgcolor="white" onload="initPage()">


<table width="400" cellpadding="3" cellspacing="5">
<tr>
<td id="tableProps" valign="top" align="left"><img id="pagerrorImg" SRC="pagerror.gif"
width="25" height="33"></td>
<td id="tableProps2" align="left" valign="middle" width="360"><h1 id="term1"
style="COLOR: black; FONT: 13pt/26pt 宋体, MS Song"><span id="errorText">您无权查看该网页</span></h1>
</td>
</tr>
<tr>
<td id="tablePropsWidth" width="400" colspan="2"><font id="LID1"
style="COLOR: black; FONT: 9pt/12pt 宋体, MS Song">您可能没有权限用您提供的凭据查看此目录或网页。</font></td>
</tr>
<tr>
<td id="tablePropsWidth" width="400" colspan="2"><font id="LID2"
style="COLOR: black; FONT: 9pt/12pt 宋体, MS Song"><hr color="#C0C0C0" noshade>
<p ID="term3"> 如果您确信能够查看该目录或网页,请尝试使用<script> Homepage();</script>主页上所列的电子邮件地址或电话与网站联系。</p>
<p id="term4">可以单击<a href="javascript:doSearch()"><img border=0 src="search.gif" width="16" height="16" alt="search.gif (114 字节)" align="center">搜索</a>,寻找 Internet 上的信息。</p>
<p><br>
</p>
<h2 id="errortextcode" style="font:9pt/12pt 宋体, MS Song; color:black">HTTP 错误 403 - 禁止访问 <BR>
Internet Explorer </h2>
</font></td>
</tr>
</table>
</body>
</html>
melodylee 2004-12-29
  • 打赏
  • 举报
回复
呵呵,确实function写的不对,可是现在还是刷新不了页面,找不到地址
而且在</select><input type="submit" name="ConfirmServiceButton" value="确定" id="ConfirmServiceButton" onClick="return(confirmSubmit(''));" style="Z-INDEX: 106; LEFT: 672px; POSITION: absolute; TOP: 16px" /></FONT></form>
</body>
</HTML>点击之后怎么找不到那个页面
nobody123 2004-12-28
  • 打赏
  • 举报
回复
~帮顶
melodylee 2004-12-28
  • 打赏
  • 举报
回复
就是在webform1里报的错
melodylee 2004-12-28
  • 打赏
  • 举报
回复
有报错呀
错误是页面上的
行:11
字符:11
错误:缺少':'

代码:0

welshem 2004-12-28
  • 打赏
  • 举报
回复
有报错吗?
melodylee 2004-12-28
  • 打赏
  • 举报
回复

</select><input type="submit" name="ConfirmServiceButton" value="确定" id="ConfirmServiceButton" onClick="return(confirmSubmit('http://localhost/Website/county/frame.htm'));" style="Z-INDEX: 106; LEFT: 672px; POSITION: absolute; TOP: 16px" /></FONT></form>
</body>
</HTML>

我刚才测试一下,执行之后的源文件是上面的代码,可是上面的那个页面还是没有刷新呀,各位大虾,怎么办
welshem 2004-12-28
  • 打赏
  • 举报
回复
<script language="javascript">
fuction confirmSubmit(url)
{
window.parent.frames(0).location.replace(url);
return false;
}
</script>

private void Page_Load(object sender, System.EventArgs e)
{

ConfirmServiceButton.Attributes.Add("onClick", "return(confirmSubmit('"+ Session["你的SessionKey"]+"'));");}
realsnow 2004-12-28
  • 打赏
  • 举报
回复
你查一下帮助,应该是:yourtargetFrame.location=url

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧