如何从我的网站打开网页 [英] How I can open a web page from my website

查看:102
本文介绍了如何从我的网站打开网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大事记,

我如何用C#代码从网站上打开网页,例如在按钮控件的Onclick方法中,我使用了JavaScript来构建网页,而ActionScript是Coldfusion. Javascript和ActionScript具有"getURL()"功能,而Coldfusion具有"cflocation"标记:

Javascript和ActionScript:

Greatings,

How I can open a web page from my website on the C# code, for example in a Onclick method of an button control, i used build web pages with JavaScript too Coldfusion with ActionScript. Javascript and ActionScript have "getURL()" function, and Coldfusion has "cflocation" tag:

Javascript and ActionScript:

getURL("Page1.html");



Coldfusion:



Coldfusion:

<cflocation url="Page1.cfm">



我有Visual Studio 2008
-------------------------------------------
我正在尝试使用按钮单击导航到新网页.我使用了Christian Graus建议的RegisterClientScriptBlock方法,非常感谢,但是getURL()函数不起作用:



I have Visual Studio 2008
-------------------------------------------
I''m trying to navigate to a new webpage using a button click. I used RegisterClientScriptBlock method that Christian Graus suggest, Thanks very much, but the getURL() function not work:

protected void Button1_Click(object sender, EventArgs e)
    {
       ClientScriptManager myClientScriptManager = Page.ClientScript;
      myClientScriptManager.RegisterClientScriptBlock(this.GetType(),  "Script1", "getURL(''Page1.aspx'');", true);
    }



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

跌宕起伏!很抱歉,是的,getURL是来自ActionScript的,而window.open是来自JavaScript的,我很困惑.感谢Christian Graus,我的代码可以这样工作:



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

Upsss!! so sorry, yes getURL is from ActionScript and window.open from JavaScript, I was confused. Thanks Christian Graus, my code work so:

protected void Button1_Click(object sender, EventArgs e)
    {
       ClientScriptManager myClientScriptManager = Page.ClientScript;
      myClientScriptManager.RegisterClientScriptBlock(this.GetType(),  "Script1", "window.open(''Page1.aspx'', ''_top'');", true);
    }


非常感谢您的帮助:thumbsup :: thumbsup :: thumbsup:


Thanks Very much for your help:thumbsup::thumbsup::thumbsup:

推荐答案

写道:

如何使用C#代码从我的网站打开网页,

How I can open a web page from my website on the C# code,



我假设您正在使用ASP.NET? Javascript和Actionscript在客户端计算机上运行. C#在服务器上运行.使用C#进行此操作的唯一方法是使用RegisterClientScriptBlock方法添加脚本(可能是对window.open的调用)来将JavaScript注入页面中.



I assume you''re using ASP.NET ? Javascript and Actionscript run on the client machine. C# runs on the server. The only way to do this with C# is to inject javascript to do it into the page, using the RegisterClientScriptBlock method to add the script, presumably a call to window.open.


getURL不会用Javascript打开一个新页面. window.open可以做到这一点.
getURL does NOT open a new page in Javascript. window.open does that.


是的,我使用ASP .NET. BUt C#具有和相似的功能吗?
Yes, I use ASP .NET. BUt C# has and function similar?


这篇关于如何从我的网站打开网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆