Re: How to open a text file on the client ?
- From: Romu <Romu@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 16 Feb 2009 02:19:00 -0800
I forgot to answer the last part of your post.
Displaying the log file in the current HTML page is not satisfying as some
logs are made of 35000 lines.
But displaying the log in a new HTML page could be an elegant solution. I'm
going to search how to do that, but if you have some code examples, feel free
to post them here.
Many thanks for the help.
"Hans Kesting" wrote:
Romu expressed precisely :.
Dear all,
I'm pretty new to ASP.net even I have some experience with .net.
For my company, I'm developping a build system, this build system is made
from 2 parts :
- a set of powershell scripts
- an asp.net web interface
These 2 parts are located in the same computer.
The scripts deals with the network creating and copying files on a network
share without any problem.
I'm using impersonation for the asp.net to be able to launch the scripts and
this works pretty well. My only problem is when I want to be able to display
the scripts logs on the client side, they are text files and I would like to
be able to open these files, ideally, using the shell extensions (notepad,
...).
The results are displayed on the web page through a TreeView, I tried 2 ways
to do that without success :
- by using the OnSelectedChange event, the value of the TreeNodes is the
file path,
- by using the NavigateUrl property
In both case, nothing happens, my computing environment is XP Pro SP3, IIS
5.1, asp.net 3.5 SP1, and I'm testing with Firefox 3.
Any help would be realy appeciated, really.
Thanks in advance.
I guess those scripts run on the server and you can catch their output
(or wait for the script to finish and pick up the output file).
It is possible to send a file to the browser but you can't
automatically have it processed by the "default application", for
security reasons.
Send a file to the browser and trigger a "save" dialog:
Response.Clear();
Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition",
"attachment;filename=log.txt");
Response.WriteFile(locallogfile);
Response.End();
If you want to show the result immediately, why not show it in the
resulting page as part of the HTML? Fill some Label with the text, but
first replace Environment.Newline with "<br/>".
Hans Kesting
- References:
- How to open a text file on the client ?
- From: Romu
- Re: How to open a text file on the client ?
- From: Hans Kesting
- How to open a text file on the client ?
- Prev by Date: Re: How to open a text file on the client ?
- Next by Date: Re: How to open a text file on the client ?
- Previous by thread: Re: How to open a text file on the client ?
- Next by thread: Invalid Postback issue
- Index(es):
Relevant Pages
|