gpt4 book ai didi

.net - asp.net LinkBut​​ton 超链接问题

转载 作者:行者123 更新时间:2023-12-03 21:33:50 24 4
gpt4 key购买 nike

我的页面上有以下两个控件:

<asp:LinkButton ID="OpenLB" runat="server" >Open</asp:LinkButton>
<asp:HyperLink ID="OpenHL" runat="server">Open</asp:HyperLink>

我在页面加载期间设置它们,如下所示:
OpenLB.PostBackUrl = @"file:\\web\documents-emails\doc1.docx";
OpenHL.NavigateUrl = @"file:\\web\documents-emails\doc1.docx";

OpenHL 工作,它打开word 文件。

OpenLB 不起作用,当我点击它时,我收到一个错误弹出窗口,上面写着:

Windows Internet Explorer Cannot find file 'file://web//documents-emails//doc1.docx'. Make sure the path or Internet address is correct.



看起来 url 不同或什么的,我该如何解决这个问题?

最佳答案

LinkBut​​ton 的工作原理是使用给定的 url 将网页发布回服务器。它以超链接的样式显示按钮,但使用 javascript 将表单发送回给定 url 的服务器。您将无法通过 file: 使用它url,因为您无法发布到本地文件。 HyperLink 只是创建一个 anchor ,当点击浏览器时,它会导致浏览器的位置设置为 url。

关于.net - asp.net LinkBut​​ton 超链接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2389393/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com