将.cs的图像数组访问到Java脚本 [英] To access the image array of .cs to java scripts

查看:74
本文介绍了将.cs的图像数组访问到Java脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问.cs的图像数组到Java脚本??

假设我的.cs文件在下面:-

How can i access the image array of .cs to java scripts???

Suppose my .cs file is below:-

String[] files = System.IO.Directory.GetFiles("d:\\picture");


存在4个.jpg文件.

我想从.js文件访问该.cs文件的图像数组.
我该如何解决以上问题??????

请任何人帮助我...


There are 4 exist .jpg files.

I want to that image array of .cs file to access from .js file.
How will i solve above problem?????

Please help me anybody...

推荐答案

您可能无法-或如果可以,则可能会带来重大的安全风险.
问题是C#代码在服务器上执行,而JS代码在客户端上运行.
这意味着C〜代码返回的文件路径是服务器上硬盘驱动器的绝对路径.如果JS代码可以访问该路径,那么世界上其他所有人也都可以访问该路径,而不必通过您的网站.这不是一个好主意!

我不知道您想做什么,您认为这是个好主意,但是我认为您需要重新考虑网站的工作方式,然后再继续这条路.
You probably can''t - or if you can, it is likely to be a major security risk.
The problem is that the C# code is executed on the Server, while the JS code is run on the Client.
This means that the paths of the files that the C~ code returns are an absolute path to an hard drive on the Server. If the JS code has access to that path, then so does everybody else in the world, without having to go via your web site. Not a good idea!

I don''t know what you are tying to do, that you think that would be a good idea, but I think you need to reconsider how your site is going to work before you continue down this road.


这篇关于将.cs的图像数组访问到Java脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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