Click here to Skip to main content
15,917,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi.
i want to open a html file which is stored in side a folder of application.this html file is generated dynamically while running the application .when i m using process.start(@filepath)for opening the file it works fine on my pc but after configuring on iis server it wont open that html file so suggest me what should i do o open the file while running the application on server
Posted
Comments
I.explore.code 22-Aug-12 4:05am    
why do you want to do that on a server?? Are the users gonna see that file?

It seems like you are terminally confused about 'applications' (I guess this is a web app), client/server infrastructure and where things actually happen. This isn't entirely your fault as ASP.net is one giant exercise in obfuscating the client/server boundary and pretending that the whole thing is a standalone app on the user's machine.

But it isn't. Any code you write in your 'code behind' will execute on the server, and any external side effects will only be visible there – i.e. the user sitting at their browser won't be able to see any message boxes or processes you try to start. (Let's skip over the fact that the permissions on an ASP.net script probably don't even allow such things.)

If you generate a HTML file as a result of a request made on a web app, why not include that HTML content in the response, so when the user does whatever action this is, they see it? Or if it's supposed to be a downloadable document (in which case it should be a PDF or similar, not HTML), then you need to stash it somewhere where it's URL accessible, or have it generated in a separate script which you can provide a URL to, and have the browser request that URL.
 
Share this answer
 
Comments
Zoltán Zörgő 22-Aug-12 7:24am    
Good point! My 5!
atul tr 22-Aug-12 7:49am    
can u tell me how to add the content of html in response and show to user on button click event
BobJanova 22-Aug-12 8:14am    
<input type="button" önclick="window.location=someurl.aspx"/>
(or a submit button in a <form action=someurl.aspx>)
... and have someurl.aspx render the content.

I mean, the whole purpose of server side scripting is to generate HTML and send it back to the client. If you can't do that then you need to go back to step 1 and learn how to use it.
IIS Express and development server are not services, they run in your user space.
1) As interactive user, you can create interactive process, a service is not allowed by default to interact with the desktop - who would ever see it on a server, where nobody is logged on? And IIS is a service. By the way, on kernel v6 and above there is a "session 0" isolation also.
2) To start a document from shell, you (the os) need to know the extension associations. As these are user level settings in registry, a technical user as NETWORK SERVICE won't have these settings by default

Opening a file is one thing, starting the associated application is an other. So what is your intention with it?
 
Share this answer
 
v2
First of all, what is the need for opening html file on the server? none of the users are going to see that.
What is the exact requirement?
 
Share this answer
 
Comments
atul tr 22-Aug-12 7:41am    
ok i m generating a report and storing the report in one folder in html formate.now on a buton click that report should open. for opening that repot i m using process.start("completFilePath").so it is working fine in Visual Studio but while running with iis it wont work so tell what to do
pramod.hegde 22-Aug-12 8:18am    
Hi,
All you are doing is viewing the generated html file. So, do not use Process.Start('filePath'). Instead use window.open('html file').

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