Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 06-02-2008, 07:52 PM   #1 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default 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
Quote:
file:///C:\WINDOWS
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
mad1231moody is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 06-02-2008, 10:03 PM   #2 (permalink)
-The BlacKCoaT Operative-
 
Rollercoaster's Avatar
 
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
Default 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- रोलरकोस्टर
Rollercoaster is offline  
Old 06-02-2008, 10:30 PM   #3 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default 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
mad1231moody is offline  
Old 07-02-2008, 01:02 AM   #4 (permalink)
MMO Addict
 
amitava82's Avatar
 
Join Date: Jul 2004
Location: Bangalore
Posts: 1,474
Default 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..
__________________
Steam Profile || Personal Page
Warp drive active. Approaching stargate.
amitava82 is offline  
Old 07-02-2008, 05:11 PM   #5 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default 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
mad1231moody is offline  
Old 08-02-2008, 12:13 AM   #6 (permalink)
MMO Addict
 
amitava82's Avatar
 
Join Date: Jul 2004
Location: Bangalore
Posts: 1,474
Default Re: ASP doesn't opens files

Try this:
<%=str%>
__________________
Steam Profile || Personal Page
Warp drive active. Approaching stargate.
amitava82 is offline  
Old 09-02-2008, 09:01 AM   #7 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default Re: ASP doesn't opens files

So you say I should try like this
Quote:
<a href=<%=str%>>Click me</a>
mad1231moody is offline  
Old 09-02-2008, 09:35 AM   #8 (permalink)
MMO Addict
 
amitava82's Avatar
 
Join Date: Jul 2004
Location: Bangalore
Posts: 1,474
Default Re: ASP doesn't opens files

<a href="<%=$str%>">Click me</a>

Why not you just try it rather than asking for confirmation!
__________________
Steam Profile || Personal Page
Warp drive active. Approaching stargate.
amitava82 is offline  
Old 09-02-2008, 02:06 PM   #9 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default Re: ASP doesn't opens files

Well mate it is not working . Please if any more tricks u can get please
mad1231moody is offline  
Old 11-02-2008, 02:53 PM   #10 (permalink)
-The BlacKCoaT Operative-
 
Rollercoaster's Avatar
 
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
Default 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.
Rollercoaster is offline  
Old 11-02-2008, 06:34 PM   #11 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default Re: ASP doesn't opens files

Well mate that is the real prob, I want the file:/// to open. http:/// works fine anyways
mad1231moody is offline  
Old 11-02-2008, 07:12 PM   #12 (permalink)
-The BlacKCoaT Operative-
 
Rollercoaster's Avatar
 
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
Default 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
Rollercoaster is offline  
Old 12-02-2008, 12:39 AM   #13 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default 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
mad1231moody is offline  
Old 12-02-2008, 02:05 AM   #14 (permalink)
Alpha Geek
 
Krazy_About_Technology's Avatar
 
Join Date: Jun 2004
Location: Noida - India
Posts: 765
Default Re: ASP doesn't opens files

Quote:
Originally Posted by Rollercoaster View Post
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
Krazy_About_Technology is offline  
Old 12-02-2008, 11:39 AM   #15 (permalink)
-The BlacKCoaT Operative-
 
Rollercoaster's Avatar
 
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
Default 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
Rollercoaster is offline  
Old 12-02-2008, 12:36 PM   #16 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default Re: ASP doesn't opens files

Quote:
Originally Posted by Krazy_About_Technology View Post
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 View Post
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!!
mad1231moody is offline  
Old 12-02-2008, 02:29 PM   #17 (permalink)
-The BlacKCoaT Operative-
 
Rollercoaster's Avatar
 
Join Date: Mar 2005
Location: Dehradun, India
Posts: 1,205
Default 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- रोलरकोस्टर
Rollercoaster is offline  
Old 12-02-2008, 02:38 PM   #18 (permalink)
In The Zone
 
mad1231moody's Avatar
 
Join Date: Sep 2007
Posts: 237
Default 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
mad1231moody is offline  
Old 13-02-2008, 01:54 AM   #19 (permalink)
Alpha Geek
 
Krazy_About_Technology's Avatar
 
Join Date: Jun 2004
Location: Noida - India
Posts: 765
Default 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
Krazy_About_Technology is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
When I press 1,www.mobilemastee.com opens? raj.singla Software Q&A 12 17-01-2008 11:48 AM
orkut opens to developers narangz Technology News 1 03-11-2007 08:51 PM
:( Each folder opens in its own window? zaki847 Software Q&A 3 11-07-2007 03:42 AM
Cd writer does not opens abhijit_116 Hardware Q&A 1 16-01-2007 06:53 AM
Help My explorer opens in new window. fordac Software Q&A 8 17-11-2006 09:11 AM

 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:50 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2