Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Open a file on a share from web page

Reply
Thread Tools

Open a file on a share from web page

 
 
tshad
Guest
Posts: n/a
 
      10-31-2009
I have a file I just wrote out to a share from my web page and I want to be
able to open it on my local machine in excel (it is a csv file).

Can I do that from a link?

Thanks,

Tom


 
Reply With Quote
 
 
 
 
tshad
Guest
Posts: n/a
 
      10-31-2009
Nevermind, I got it.

<a file://H:\fileName>fileName</a>

Tom

"tshad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a file I just wrote out to a share from my web page and I want to be
>able to open it on my local machine in excel (it is a csv file).
>
> Can I do that from a link?
>
> Thanks,
>
> Tom
>



 
Reply With Quote
 
 
 
 
tshad
Guest
Posts: n/a
 
      10-31-2009

"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:esw%(E-Mail Removed)...
> "tshad" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> Nevermind, I got it.
>>
>> <a file://H:\fileName>fileName</a>

>
> Forget that completely. It only works on your machine because your machine
> has a drive mapping to the server share.
>


But the server where IIS is located also has the same share set up as H:
(all the machines have it set up this way).

> If you absolutely need to use remote resources, then you will need to open
> them with the System.IO namespace and then stream them to the client via a
> MIME type which the client browser will understand...
>


How would I do that?

At the moment, my code does:

fs = new FileStream(fileName, FileMode.Create,
FileAccess.ReadWrite);
csvFileWriter = new StreamWriter(fs);

Where fileName is:

fileNameOut = @"H:\SHARE\Reports\" +
Path.GetFileNameWithoutExtension(((Label)GridView1 .Rows[1].FindControl("lblFileName")).Text)
+
"_Discrepancies.csv";

You are saying I can't do this, right?

H:\SHARE is acessible to all the company and all have read and write
permission.

So how would I change this to do the MIME business?

What about putting the folder inside the web app?

Would that work?

What about accessing the file from the Share (if I could write to it). I
did that to solve the SaveFileDialog problem where I would click the link
and it would allow me to open it (via excel) or save it to my system using
the following as my link:

<a
href=file:///H:/SHARE/Reports/148_010309_033109_Discrep.csv>148_010309_033109_Di screp.csv</a>

Again this works fin from my machine.

Thanks,

Tom

>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      11-01-2009

"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "tshad" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>
>> You are saying I can't do this, right?

>
> You're the one who's saying it doesn't work!
>

I am saying I can't get it to work on my server.

> When you step through the code, how far does it get...?


I can't really step through the code on the server as I don't have VS there.

In your earlier post you said:

If you absolutely need to use remote resources, then you will need to open
them with the System.IO namespace and then stream them to the client via a
MIME type which the client browser will understand

Wasn't that what I was using when I did:

fs = new FileStream(fileName, FileMode.Create,
FileAccess.ReadWrite);
csvFileWriter = new StreamWriter(fs);

You asked how far I got - I got to the FileStream, I believe since the
message said:

Could not find a part of the path
'H:\SHARE\Reports\043_051909_083109_Discrepancies. csv'.

>
>> Again this works fine from my machine.

>
> True but irrelevant since your machine isn't the webserver...
>

Maybe not, but wouldn't my machine have the same problem since it is
pointing at the same share?

Thanks,

Tom
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      11-01-2009

"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "tshad" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>>>> Again this works fine from my machine.
>>>
>>> True but irrelevant since your machine isn't the webserver...
>>>

>> Maybe not, but wouldn't my machine have the same problem since it is
>> pointing at the same share?

>
>
> Absolutely not! The default account under which ASP.NET runs almost
> certainly has no permission to access anything outside its own virtual
> directory...
>

That makes sense and as we talked in the other post that the problem was
that the mapped drive won't work for the IIS service as the mappings I have
on my machine (or that I set up on the server under my account) won't apply.

Thanks,

Tom
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
[ANN] clogger 0.3.2 - share a hacker, share a bug Eric Wong Ruby 0 02-13-2010 10:42 AM
Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application i want to know how to open a worddocument in open office or any other applicatio Fredrik Lundh Python 1 01-09-2008 10:40 AM
question DRb class definition share or not share Jack Ruby 2 10-11-2007 05:26 PM
Wireless Network - Setup - How? See/share Files, share printers, how? Wayne Wireless Networking 2 04-08-2006 04:34 PM



Advertisments