经典 ASP 在服务器上打开目录

发布于 2024-12-10 17:24:07 字数 858 浏览 0 评论 0原文

我想通过链接打开位于服务器上的目录。 我的问题是它在 .htm 页面中完美运行,但在 .asp 页面中运行不正常。 这是我使用的:

<a href="file://server/folder/folder/folder" target="_blank">Foldername</a>

我尝试在文件后使用 3 或 5 个斜杠:但结果相同。 我发现没有结果的另一件事是:

<a href="file://server/folder/folder" onclick="window.open(this.href, 'popupwindow', 'width=400,height=300,scrollbars,resizable'); return false;">Link</a>

在尝试在 html 中弄清楚之后,我在 asp 中尝试了以下操作:

<%
str_url="file://server/folder/folder"
Response.Write("<script>") 
Response.Write("window.open('" & str_url & "', 'myWin','height=800,width=1024,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes');") 
Response.Write("</script>")
%>

但在多次尝试让东西正常工作后,我仍然把头撞在墙上。这可能是 IIS7 中禁用的功能吗?或者我错过了什么?

提前致谢

I want to open a directory, that sits on a server, through a link.
My problem is that it works perfectly in an .htm page but not in an .asp page.
Here is what i use:

<a href="file://server/folder/folder/folder" target="_blank">Foldername</a>

I have tried using 3 or 5 slashes after the file: but the same result.
A different thing i found without result is:

<a href="file://server/folder/folder" onclick="window.open(this.href, 'popupwindow', 'width=400,height=300,scrollbars,resizable'); return false;">Link</a>

After trying to figure it out in html i tried the following in asp:

<%
str_url="file://server/folder/folder"
Response.Write("<script>") 
Response.Write("window.open('" & str_url & "', 'myWin','height=800,width=1024,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes');") 
Response.Write("</script>")
%>

But after several attempts to get stuff working i'm still banging my head against the wall. Could this perhaps be a disabled function in IIS7? Or am i missing something?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ヤ经典坏疍 2024-12-17 17:24:07

file:// 样式链接仅适用于您的本地计算机,您无法使用该方法打开远程服务器上的文件夹。 (除非可以从本地计算机、服务器共享等访问该路径)

The file:// style links will only work for you on your local machine, you cannot open a folder on a remote server using that method. (well not unless that path is accessable from your local machine, a server share or somesuch)

一抹微笑 2024-12-17 17:24:07

显示目录的一些示例代码:

<table cellspacing="0">
    <tr>
        <th style="width: 25px"> </th>
        <th>Document</th>
        <th style="width: 60px">Size</th>
    </tr>
    <%
    Dim iCounter, iFileSize
    Dim oFS, oFL
    Dim sDirectory

    sDirectory = "directory/you/want"
    iCounter = 0

    Set oFS = Server.CreateObject("Scripting.FileSystemObject")
    Set oFL = oFS.GetFolder(Server.MapPath(sDirectory))

    For Each oF In oFL.Files
        iCounter = iCounter + 1

        iFileSize = FormatNumber(CLng(oF.Size) / 1024 / 1024, 2)
    %>
    <tr>
        <td><%=iCounter %>.</td>
        <td><a href="<%=sDirectory %>/<%=oF.Name %>" target="_blank"><%=oF.Name %></a></td>
        <td><%=iFileSize %> MiB</td>
    </tr>
    <%
    Next
    %>
</table>

Some sample code to display a directory:

<table cellspacing="0">
    <tr>
        <th style="width: 25px"> </th>
        <th>Document</th>
        <th style="width: 60px">Size</th>
    </tr>
    <%
    Dim iCounter, iFileSize
    Dim oFS, oFL
    Dim sDirectory

    sDirectory = "directory/you/want"
    iCounter = 0

    Set oFS = Server.CreateObject("Scripting.FileSystemObject")
    Set oFL = oFS.GetFolder(Server.MapPath(sDirectory))

    For Each oF In oFL.Files
        iCounter = iCounter + 1

        iFileSize = FormatNumber(CLng(oF.Size) / 1024 / 1024, 2)
    %>
    <tr>
        <td><%=iCounter %>.</td>
        <td><a href="<%=sDirectory %>/<%=oF.Name %>" target="_blank"><%=oF.Name %></a></td>
        <td><%=iFileSize %> MiB</td>
    </tr>
    <%
    Next
    %>
</table>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文