 |
06-02-2008, 07:52 PM
|
#1 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
ASP doesn't opens files
Hi friends, got a query and need solution as soon as I can. You may be knowing that in HTML if we use this
Quote:
|
<a href="file://C:\WINDOWS"> Open</a>
|
When I click on open it opens WINDOWS folder in Explorer. But this is not the case in asp. Although when I bring the mouse on the link in ASP, I get the same path as I get in HTML,i.e
But when I click it nothing happens.So please tell me a way on how do I open files and folders in asp.
Another query
Quote:
<% @language=VBScript %>
<% Option Explicit %>
<% dim str
str="file://C:\WINDOWS"
%>
|
Now I want this string to be passed in an HTML file,and use it in
<a href="file://C:\WINDOWS"> in the html file. Please guide if this is possible. waiting for your response
|
|
|
|
Advertisements. Register and be a member of the community to get rid of them.
|
|
Advertisement
|
|
06-02-2008, 10:03 PM
|
#2 (permalink)
|
|
-The BlacKCoaT Operative-
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
|
Re: ASP doesn't opens files
i tried what u said and it truly doesn't work. i found thru trial n error that it works for files under the website directory only. may be there is some property we need to specify or un-specify that is causing this.
__________________
--------------------------------------------
Holding my last breath, safe inside myself.....
--------------------------------------------
I dont use my computer. I misuse it- रोलरकोस्टर
|
|
|
06-02-2008, 10:30 PM
|
#3 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
Yes it does opens files .jpg, .txt . But it is unable to open folders in win explorer. Do you have an answer for my second query
|
|
|
07-02-2008, 01:02 AM
|
#4 (permalink)
|
|
MMO Addict
Join Date: Jul 2004
Location: Bangalore
Posts: 1,474
|
Re: ASP doesn't opens files
can't you just echo out the 'str'?
IN PHP we do like this:
<a href="<?php echo $str; ?> ">Click me</a>
So, in asp echo out the str in a asp tag..
|
|
|
07-02-2008, 05:11 PM
|
#5 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
Well can u please make sure if echo can be used in asp. Cause I am not using php for this purpose
|
|
|
08-02-2008, 12:13 AM
|
#6 (permalink)
|
|
MMO Addict
Join Date: Jul 2004
Location: Bangalore
Posts: 1,474
|
Re: ASP doesn't opens files
Try this:
<%=str%>
|
|
|
09-02-2008, 09:01 AM
|
#7 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
So you say I should try like this
Quote:
|
<a href=<%=str%>>Click me</a>
|
|
|
|
09-02-2008, 09:35 AM
|
#8 (permalink)
|
|
MMO Addict
Join Date: Jul 2004
Location: Bangalore
Posts: 1,474
|
Re: ASP doesn't opens files
<a href="<%=$str%>">Click me</a>
Why not you just try it rather than asking for confirmation!
|
|
|
09-02-2008, 02:06 PM
|
#9 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
Well mate it is not working  . Please if any more tricks u can get please
|
|
|
11-02-2008, 02:53 PM
|
#10 (permalink)
|
|
-The BlacKCoaT Operative-
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
|
Re: ASP doesn't opens files
try
Code:
<a href="
<%
string str = @"http://www.thinkdigit.com";
Response.Write(str);
%>
">sometext</a>
works with web addresses but it will still not open any file with the file:///
note- code in c#
__________________
--------------------------------------------
Holding my last breath, safe inside myself.....
--------------------------------------------
I dont use my computer. I misuse it- रोलरकोस्टर
Last edited by Rollercoaster; 11-02-2008 at 02:58 PM.
|
|
|
11-02-2008, 06:34 PM
|
#11 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
Well mate that is the real prob, I want the file:/// to open. http:/// works fine anyways
|
|
|
11-02-2008, 07:12 PM
|
#12 (permalink)
|
|
-The BlacKCoaT Operative-
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
|
Re: ASP doesn't opens files
if u can tell here what u want to build that may be i can give better alternatives.
you can also try to use a asp:HyperLink with this code in its click event
System.Diagnostics.Process.Start(@"c:\windows");
or open a pop up self closing window with
<%
System.Diagnostics.Process.Start(@"c:\windows");
%>
__________________
--------------------------------------------
Holding my last breath, safe inside myself.....
--------------------------------------------
I dont use my computer. I misuse it- रोलरकोस्टर
Last edited by Rollercoaster; 11-02-2008 at 07:12 PM.
Reason: Automerged Doublepost
|
|
|
12-02-2008, 12:39 AM
|
#13 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
Mate I am preparing a search engine. As you know that the FolderExists and FileExists method of the FileSystemObject can be used to find out a file or folder exists on the server or not. In my case the server is localhost.
The Getfile method can then be used to find the attributes like Date last modified,Last accessed and Path. Now what I want to do is open the path that I get. I thought that using <a href=path> will be the best idea, but it is not so. @Rollercoaster the code you gave in above post, can u write a sample basic code and post it here. As I am not familiar with the code you have written. I hope I can get some help
|
|
|
12-02-2008, 02:05 AM
|
#14 (permalink)
|
|
Alpha Geek
Join Date: Jun 2004
Location: Noida - India
Posts: 765
|
Re: ASP doesn't opens files
Quote:
Originally Posted by Rollercoaster
if u can tell here what u want to build that may be i can give better alternatives.
you can also try to use a asp:HyperLink with this code in its click event
System.Diagnostics.Process.Start(@"c:\windows");
or open a pop up self closing window with
<%
System.Diagnostics.Process.Start(@"c:\windows");
%>
|
Dude he is not using ASP.NET, its vanilla ASP.
Now as for your problem, the code that writes the exact line in the browser is :
Code:
<a href=<% response.write(chr(34) & "file://c:/" & chr(34)) %>>Open C Drive</a>
But if you run it as an asp page it wont open the c drive even when the html code is correct. You can check this by using View Source and then copying and pasting the html code in a local html file.
The reason for this is when an asp page is served, it is first parsed using the asp parser isapi dll on iis. Then iis sends the resultant html to client. Now all the html when arrives on client is first stored in the temporary internet files folder (or the cache) and then it is displayed. That folder is a special system folder and is protected. You cant run any system commands from there an thats why the link is not working.
Although i am aware that there is a way to bypass this, i cant remember it now. I'll post back when i get it again. Ok.
__________________
Dell Inspiron 1525 - C2D 2 Ghz, 3GB, 250GB, X3100 :)
Samsung Omnia Pro B7610 with Stock WM 6.1 ROM
Blog: http://www.sumitbhardwaj.co.in/blog
|
|
|
12-02-2008, 11:39 AM
|
#15 (permalink)
|
|
-The BlacKCoaT Operative-
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
|
Re: ASP doesn't opens files
i was under the impression that we are talking abt asp.net...
i have zero idea abt asp. never ever used it. started directly with .net
the best way would be to ask some javascript guru to write u a page start executing code which does-
1. hyperlink to open a popup/invisible windows
2. open the file/folder from that window
3. popup window closes itself
__________________
--------------------------------------------
Holding my last breath, safe inside myself.....
--------------------------------------------
I dont use my computer. I misuse it- रोलरकोस्टर
Last edited by Rollercoaster; 12-02-2008 at 11:39 AM.
Reason: Automerged Doublepost
|
|
|
12-02-2008, 12:36 PM
|
#16 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
Quote:
Originally Posted by Krazy_About_Technology
Dude he is not using ASP.NET, its vanilla ASP.
Now as for your problem, the code that writes the exact line in the browser is :
Code:
<a href=<% response.write(chr(34) & "file://c:/" & chr(34)) %>>Open C Drive</a>
But if you run it as an asp page it wont open the c drive even when the html code is correct. You can check this by using View Source and then copying and pasting the html code in a local html file.
The reason for this is when an asp page is served, it is first parsed using the asp parser isapi dll on iis. Then iis sends the resultant html to client. Now all the html when arrives on client is first stored in the temporary internet files folder (or the cache) and then it is displayed. That folder is a special system folder and is protected. You cant run any system commands from there an thats why the link is not working.
Although i am aware that there is a way to bypass this, i cant remember it now. I'll post back when i get it again. Ok.
|
Thanks Crazy for the xplanation mate. Now I know that it is not possible to open folders. I hope u get the solution soon. Please mate m in hurry
Quote:
Originally Posted by Rollercoaster
i was under the impression that we are talking abt asp.net...
i have zero idea abt asp. never ever used it. started directly with .net
the best way would be to ask some javascript guru to write u a page start executing code which does-
1. hyperlink to open a popup/invisible windows
2. open the file/folder from that window
3. popup window closes itself
|
@Rollercoaster thanks for the ideas, but I have not got what u wanna say. SUre I have books for Javascript but can't make out much from them. Please I am a noob and would like you to post a sample code. Please I request again!!
|
|
|
12-02-2008, 02:29 PM
|
#17 (permalink)
|
|
-The BlacKCoaT Operative-
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
|
Re: ASP doesn't opens files
i donno javascript either. you should post on some javascript/asp forum instead of here.
try- forums.aspfree.com , www.webdeveloper.com/forum/forumdisplay.php?f=3 and search google for more
i tried giving tips as much as i could but i cant do ur work for u..
__________________
--------------------------------------------
Holding my last breath, safe inside myself.....
--------------------------------------------
I dont use my computer. I misuse it- रोलरकोस्टर
|
|
|
12-02-2008, 02:38 PM
|
#18 (permalink)
|
|
In The Zone
Join Date: Sep 2007
Posts: 237
|
Re: ASP doesn't opens files
Its alright coaster, I thought that you might be knowing Javascript. Thanks for the tips. Hope crazy gets the idea soon
|
|
|
13-02-2008, 01:54 AM
|
#19 (permalink)
|
|
Alpha Geek
Join Date: Jun 2004
Location: Noida - India
Posts: 765
|
Re: ASP doesn't opens files
Yaar i dont think its gonna work. When working from ASP, you are an alien for the system. It wont allow any such thing. i even tried with this javascript based code :
Code:
<html>
<head><title>ASP Page</title></head>
<body>
<script language='javascript'>
function openwnd(pth)
{
window.open(pth);
}
</script>
<a href="#" onClick=<% response.write(chr(34) & "javascript:openwnd('file://c:/');" & chr(34)) %>>Open C Drive</a>
<body>
</html>
I think you are out of luck
__________________
Dell Inspiron 1525 - C2D 2 Ghz, 3GB, 250GB, X3100 :)
Samsung Omnia Pro B7610 with Stock WM 6.1 ROM
Blog: http://www.sumitbhardwaj.co.in/blog
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|