//抱歉 using System.Diagnostics; public class main { public static void Main() { ProcessStartInfo psi=new ProcessStartInfo(@"c:\filetest\ww.doc"); Process p=new Process(); p.StartInfo=psi; p.Start(); } }
MapPath Example For the examples below, the file data.txt is located in the directory, C:\Inetpub\Wwwroot\Script, as is the test.asp file that contains the following scripts. The C:\Inetpub\Wwwroot directory is set as the server's home directory.The following example uses the server variable PATH_INFO to map the physical path of the current file. <%= Server.MapPath(Request.ServerVariables("PATH_INFO"))%><BR>
The preceding script produces the outputc:\inetpub\wwwroot\script\test.asp<BR>
Because the path parameters in the following examples do not start with a slash character, they are mapped relative to the current directory, in this case C:\Inetpub\Wwwroot\Script. <%= Server.MapPath("data.txt")%><BR> <%= Server.MapPath("script/data.txt")%><BR>
The preceding scripts produce the following outputc:\inetpub\wwwroot\script\data.txt<BR> c:\inetpub\wwwroot\script\script\data.txt<BR>
The next two examples use the slash characters to specify that the path returned should be looked up as complete virtual paths on the server. <%= Server.MapPath("/script/data.txt")%><BR> <%= Server.MapPath("\script")%><BR>
The preceding scripts produce the following outputc:\inetpub\wwwroot\script\data.txt<BR> c:\inetpub\wwwroot\script<BR>
The following examples demonstrate how you can use either a forward slash (/) or a backslash (\) to return the physical path to the home directory of the Web site root. <%= Server.MapPath("/")%><BR> <%= Server.MapPath("\")%><BR>The preceding scripts produce the following outputc:\inetpub\wwwroot<BR> c:\inetpub\wwwroot<BR>The following examples demonstrate how you can use relative pathing to return the relative physical path to the page that is being viewed in the web browser.<%= Server.MapPath("../")%><BR> <%= Server.MapPath("..\")%><BR>
using System.Diagnostics;
public class main
{
public static void Main()
{
ProcessStartInfo psi=new ProcessStartInfo(@"c:\filetest\ww.doc");
Process p=new Process();
p.StartInfo=psi;
p.Start();
}
}
首先,Server端运行的代码能打开client端的程序吗?除非是script,运行于client端。
其次,写这样的代码安全吗?如果IE允许你随便用client端Process,MS一定疯了。
如果哪个用户居然打开这样的权限,他一定疯了。
解决的方法很长,这里说思路给你听:
1、共需要3个文件
2、wfmMain主窗体;你在这里点击某个按钮打开一个窗口。windows.open或者是一个dialog也可以。
3、htmFrame框架窗体;这个HTML文件里什么也没有,只是有一个frame,这个frame引用的是wfmFile文件。
4、wfmFile窗体;这个窗体要接收wfmMain传递过来的路径参数。然后读出来,直接使用Response.Write()上就行。
[email protected]
pp616(平平),不要幸灾乐祸,给点意见!
For the examples below, the file data.txt is located in the directory, C:\Inetpub\Wwwroot\Script, as is the test.asp file that contains the following scripts. The C:\Inetpub\Wwwroot directory is set as the server's home directory.The following example uses the server variable PATH_INFO to map the physical path of the current file. <%= Server.MapPath(Request.ServerVariables("PATH_INFO"))%><BR>
The preceding script produces the outputc:\inetpub\wwwroot\script\test.asp<BR>
Because the path parameters in the following examples do not start with a slash character, they are mapped relative to the current directory, in this case C:\Inetpub\Wwwroot\Script. <%= Server.MapPath("data.txt")%><BR>
<%= Server.MapPath("script/data.txt")%><BR>
The preceding scripts produce the following outputc:\inetpub\wwwroot\script\data.txt<BR>
c:\inetpub\wwwroot\script\script\data.txt<BR>
The next two examples use the slash characters to specify that the path returned should be looked up as complete virtual paths on the server. <%= Server.MapPath("/script/data.txt")%><BR>
<%= Server.MapPath("\script")%><BR>
The preceding scripts produce the following outputc:\inetpub\wwwroot\script\data.txt<BR>
c:\inetpub\wwwroot\script<BR>
The following examples demonstrate how you can use either a forward slash (/) or a backslash (\) to return the physical path to the home directory of the Web site root. <%= Server.MapPath("/")%><BR>
<%= Server.MapPath("\")%><BR>The preceding scripts produce the following outputc:\inetpub\wwwroot<BR>
c:\inetpub\wwwroot<BR>The following examples demonstrate how you can use relative pathing to return the relative physical path to the page that is being viewed in the web browser.<%= Server.MapPath("../")%><BR>
<%= Server.MapPath("..\")%><BR>
好像有办法,让我试试。
不过,希望有识之士能提出高见。
访问Server上的绝对路径下的文件,这不是黑客行径吗?正常的HTTP怎么可能提供这样的方法!
大致情况是: Server端代码(ASP.NET)可以访问Server端文件,基本不存在安全限制。
Client端代码(script)可以访问Client端文件,需要设置一定的安全限制(不推荐)。
Server端代码不可能随意访问Client端文件。
Client端代码可以通过URL访问Server上的文件,但绝对路径不行。
但这个问题还是要解决,如果用虚拟路径,那Client端就随意通过IE访问该文件,这是我不愿意看到的!有没有变通的办法,我想用户通过我的界面来打开存放在服务器的文件。谢谢各位的帮助!再加100分,欢迎大家继续讨论!
假定: 对一家公司的员工进行管理:
包括人员名字,出生日期,加入公司的年份,那个部门(用ring0---ring9表示10个部门) ,工资标准等(多多不限)
要求有对(假如有员工改名, 可以实现改名, 尽管使用中不常见, 但主要是为了实现面向对象思想)(更改工资标准)(开除员工和增加员工)(通过工龄即加入公司的时间来对员工进行排序, 同一年的可随便排)(通过部门的对员工排序, 个部门的集中在一起显示,譬如ring0的排了下了跟着就是全是ring1部门的)
请兄弟们快点回帖, 把源代码和程序发给我, 搞定后就给200分!!!
这是我期末考试的题目, 兄弟们要快快快!!
我的email : [email protected]
为什么不用虚拟路径,在Client端通过IE访问该文件时加上密码和权限呢??
或者像Hotmail那样自己实现用户验证的机制。
我不能再up了
这是最后一次
真希望我能够在多up几次
可是系统不让了
真遗憾