C# iframe框架下 ,如何让页面刷新后仍停留在当前页面,页面的url会带有参数,如下图
C# iframe框架下 ,怎么让页面刷新后仍停留在当前页面,页面的url会带有参数,如下图

我们在这个页面点击 “F5”后会跑到默认页 (端口号加"/Default.aspx"),点击浏览器上的刷新按钮也会跳到默认页。怎么让它停留在当前页面
------解决方案--------------------
<iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>
方案一:用iframe的name属性定位
<input type="button" name="Button" value="Button"
onclick="document.frames('ifrmname').location.reload()">
或
<input type="button" name="Button" value="Button"
onclick="document.all.ifrmname.document.location.reload()">
方案二:用iframe的id属性定位
<input type="button" name="Button" value="Button"
onclick="ifrmid.window.location.reload()">
终极方案:当iframe的src为其它网站地址(跨域操作时)
<input type="button" name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">
------解决方案--------------------
你试试吧
void Application_BeginRequest(object sender, EventArgs e)
{
String path = Request.Url.ToString();
if (Regex.IsMatch(path, ".*?/OldUrl.aspx",
RegexOptions.IgnoreCase))
{
Context.RewritePath("~/NewUrl.aspx");
}
if (Regex.IsMatch(path, ".*?/index.htm",
RegexOptions.IgnoreCase))
{
Context.RewritePath("~/NewUrl.aspx");
}
if (Regex.IsMatch(path, ".*?/News.aspx\\?ID=1",
RegexOptions.IgnoreCase))
{
Context.RewritePath("~/OldUrl.aspx");
}
//else if (Regex.IsMatch(path, "/URLRewriting/UserAccount/(.+).aspx",
//RegexOptions.IgnoreCase))
//{
// String idString =
// path.Substring(path.LastIndexOf('/') + 1,
// path.Length - path.LastIndexOf('/') - 6);
// Context.RewritePath("/URLRewriting/UserAccount.aspx?id=" +
// idString);
//}
}
------解决方案--------------------
用cookie来记住你最后的网址,每次刷新都是从优先从Cookie里面取得那个网址不就行啦。而且我觉得,没那个sb天天没事干去按F5啊
------解决方案--------------------
给你点思路,具体写法你应该会。我不写忘了。
1、使用父窗口地址栏传值的办法。
2、通过session、cookie记录。
3、通过JS记录页面的内容。如果触发了刷新事件、页面加载事件让JS帮忙跳转一下。
我们在这个页面点击 “F5”后会跑到默认页 (端口号加"/Default.aspx"),点击浏览器上的刷新按钮也会跳到默认页。怎么让它停留在当前页面
------解决方案--------------------
<iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>
方案一:用iframe的name属性定位
<input type="button" name="Button" value="Button"
onclick="document.frames('ifrmname').location.reload()">
或
<input type="button" name="Button" value="Button"
onclick="document.all.ifrmname.document.location.reload()">
方案二:用iframe的id属性定位
<input type="button" name="Button" value="Button"
onclick="ifrmid.window.location.reload()">
终极方案:当iframe的src为其它网站地址(跨域操作时)
<input type="button" name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">
------解决方案--------------------
你试试吧
void Application_BeginRequest(object sender, EventArgs e)
{
String path = Request.Url.ToString();
if (Regex.IsMatch(path, ".*?/OldUrl.aspx",
RegexOptions.IgnoreCase))
{
Context.RewritePath("~/NewUrl.aspx");
}
if (Regex.IsMatch(path, ".*?/index.htm",
RegexOptions.IgnoreCase))
{
Context.RewritePath("~/NewUrl.aspx");
}
if (Regex.IsMatch(path, ".*?/News.aspx\\?ID=1",
RegexOptions.IgnoreCase))
{
Context.RewritePath("~/OldUrl.aspx");
}
//else if (Regex.IsMatch(path, "/URLRewriting/UserAccount/(.+).aspx",
//RegexOptions.IgnoreCase))
//{
// String idString =
// path.Substring(path.LastIndexOf('/') + 1,
// path.Length - path.LastIndexOf('/') - 6);
// Context.RewritePath("/URLRewriting/UserAccount.aspx?id=" +
// idString);
//}
}
------解决方案--------------------
用cookie来记住你最后的网址,每次刷新都是从优先从Cookie里面取得那个网址不就行啦。而且我觉得,没那个sb天天没事干去按F5啊
------解决方案--------------------
给你点思路,具体写法你应该会。我不写忘了。
1、使用父窗口地址栏传值的办法。
2、通过session、cookie记录。
3、通过JS记录页面的内容。如果触发了刷新事件、页面加载事件让JS帮忙跳转一下。