Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Using the code below,
C#
<pre lang="text">
        string s = "window.open('file:////sharedFolder//Upload_Files//Design.vsd', 'popup_window', 'width=900,height=600,left=100,top=100,resizable=yes');";
        ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
<pre lang="c#">

I got
can't find "...//sharedFolder/Upload_Files/Design.vsd.  Make sure the path of internet address is corrct.

The file does exist in the folder defined.
What's wrong in y code? Thanks

What I have tried:

Tried but Can't open a file in a folder
Posted
Updated 26-Apr-16 7:13am

1 solution

URI format in incorrect. Please see: https://en.wikipedia.org/wiki/Uniform_Resource_Identifier[^].

There are no cases when you have four '/'.

Besides, make sure your file is located under the root directory set up for your site. Normally, a Web application is executed in a sandboxed environment which won't allow access to any files beyond this directory.

Perhaps your best bet is to use relative path name, without URI scheme.

—SA
 
Share this answer
 
Comments
s yu 26-Apr-16 13:41pm    
SA: Thanks for your response. For the 4 '/', I did refer to somewhere. After I changed to 'file://...', I got Access is denied error. The folder is a shared folder. I don't know how to 'use relative path' in this case. Any additional advisory? Thanks again.
Sergey Alexandrovich Kryukov 26-Apr-16 13:50pm    
Do not "refer to somewhere". Always write your code understanding each line.

If you don't know what is relative path, just either quite all kinds of computing, or sharpen your skills as a regular non-engineering computer system user, to start with. Read on paths, that would be the best way.

Now, I already explained it: it won't work this way. Shared folder won't work (isn't that obvious?! just think for a second what could it happen if it was possible). My paragraph about "sandboxed" should explain that. You have to put the file under the directory of your site. Or you can serve the file outside of it as FTP or HTTP and then relay its content in some scrip located in your site. Look, I understand that it might be over your head, but what can I do? (I will be very glad it you get it and find helpful though.) You need to educate yourself, to do Web development...

—SA
s yu 26-Apr-16 14:07pm    
Thanks. I guess I should publish the files in the shared folder as a service.
Sergey Alexandrovich Kryukov 26-Apr-16 15:43pm    
Good. You are welcome. Are you going to accept the answer formally now?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900