Web Forms :: "No Application Is Associated With The Specified File For This Operation" Error When Trying To Open File With Process.Start()

Oct 11, 2010

I have a folder called GUI. Inside GUI thers another folder called PDF and inside this folder, there are some PDF files. This folder (GUI) is uploaded to the server too. Then I have a WebForm with some ImageButtons. When I click one of these ImageButtons, I want the file to open in a new tab. I tried with the following code:

[Code]....

As you can see, I build the path using the tooltips of the different ImageButtons. The ToolTip = File Name I want to open. When I try this in debug mode, it works. It opens the pdf file in a new tab. However when I publish my website and upload it to the server... it doesn't work... when I click an ImageButton I get the following exception: No application is associated with the specified file for this operation

Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
Source Error:

[Code]....

Stack Trace:

[Code]....

[Win32Exception (0x80004005): No application is associated with the specified file for this operation]
LandingSite.LnkRelease1_Click(Object sender, EventArgs e) +215
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082

View 3 Replies


Similar Messages:

VS 2005 Process.start() Don't Open Pdf File.

Jun 10, 2010

i am using a data list with link button in it that is dynamically populated by String list. i can get accurate path of the clicked link button from the data list, and the next step is to open that document. i am using process.start() method to open pdf file but it does not open that file.i am using the following code to open pdf file from specific path.
Code:
protected void lnkbtnFirstQtrly_Click(object sender, EventArgs e)
{
try
{
//dirCustom is the DirectoryInfo variable that is global variable.

[code]...

View 4 Replies

Start Batch Job From IIS / Start Exe File With System.Diagnostics.Process.Start With Another Account Is Disabled?

Oct 28, 2010

What is the right approach when users (authenticated domain admins) should be able to start batch jobs (usually exe files) from an IIS (7.x) aspx (c#) page? This is an intranet site. The batch jobs have to run on the web server as Domain Admins. The website pool is executed by network service or some similar restricted account in AD.

Approaches I can think of (and their disadvantages):
1. Start exe file with System.Diagnostics.Process.Start with another account. This feature is disabled in IIS 7.x, how do I allow it?

2. Create a sheduled task and call scheduled task-api. This unmanaged dll is giving VS compiler warnings because it's unsafe to call from managed code.

3. I suppose there's a better approach, because the previous suggestions doesn't appear safe or robust.

View 2 Replies

Configuration :: Process.start (System.Diagnostics.Process) - Execute A Batch File

Sep 7, 2010

I've written a aspx.net(C#) page that after the user has done what they do on the page they hit a Submit button. The Submit button

1) takes the work the users was producing on the page and writes it to a file.
2) attempts to execute a batch file.

The call to the batch file is executed via:

protected void Execute123EDI()
{
try
{
string File = @"c:80sAdminSendV80s.bat";
lblCancelled.Text = lblCancelled.Text + File;
Process proc = new System.Diagnostics.Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.LoadUserProfile = false;
proc.StartInfo.UserName = "administrator";
proc.StartInfo.RedirectStandardOutput = true;
System.Security.SecureString secPass = new System.Security.SecureString();
string paswd = "123abc";
for (int i = 0; i < paswd.Length; i++)
{
secPass.AppendChar(paswd[i]);
}
proc.StartInfo.Password = secPass;
proc.StartInfo.FileName = File;
proc.Start();
FileStream fs = new FileStream(@"c:80sAdminSendV80sOutput.log", FileMode.Append);
StreamWriter sw = new StreamWriter(fs);
sw.Write(proc.StandardOutput.ReadToEnd());
proc.WaitForExit();
sw.Close();
proc.Close();
}
catch(Exception ex)
{
lblDebug.Text = lblDebug.Text + ex.Message + "<br/>";
}

If I watch the processes tab in Task Manager on the web server I see "cmd.exe" under the context of 'administrator' but it just hangs. For test purposes c:SendV80s.bat: copy c: oot.ini c:zzz.txt

If I logon onto the webserver's console and execute SendV80s.bat it works and exits without issue. But when I execute the same batch file via the Submit button it gets stuck executing in Task Manager/Process. I believe this has something to do with the fact that cmd is not running in a full environment/desktop context. I just noticed this on the actual console of the webserver (not in my RDP console but console 0 instead)

A pop-up box stating: CMD.exe Application error The application failed to initialize properly (0xc0000142). Click OK to terminate the application. And when I click on the OK button my ASPX page's WaitForExit is satisfied and the continues processing normally.

View 2 Replies

Web Forms :: Error When Trying To Open A Csv File From The Open File Dialog Box , IE 7?

Mar 3, 2011

When i try to open a csv file from my asp.net 3.5 app by clicking on the link provided, a file download dialog box appears.When i click on the open button from there , i get this eror

C:Documents and settingsUserNameLocal SettingsTemporary Internet FilesContent.IE5X9TXTM06myfilename.csv could not be found .Check the spelling of the file name and verify that the file locationis correct?

Wjy am i getting this error? I am trying to open a file and it complains about file not found in the Temporary Internet Folder.I tried deleting the temp intrnet files.Dint work.I have IE 7 on xp professional sp3. Also i am streaming the file from the application. This happens only to some files and the rest of the files , i can open .

View 1 Replies

Configuration :: Opening A File With Process.Start Outside Root Folder?

Nov 6, 2010

So, I have a webForm that has an ImageButton. This ImageButton has to open a file (said file is uploaded by the user in another web form. The file is saved to \serverNamefiles; it can be a doc file, pdf file, excel file).

So this ImageButton should open said file as you normally would. It works on debug, however when I publish my site, and run it from my localhost, it doesn't open the file. When I click the ImageButton it just does the postback and nothing happens.

The code for the ImageButton is just:

Process.Start(fileName);

fileName has the full path of the file I want to open, in this case it has: \serverNamefilesmyFile.pdf

View 11 Replies

Configuration :: Error 1 Could Not Open Source File: Could Not Find File 'C:11-22 EstobjDebugCSAutoParameterize RansformedWeb.config'. 0 0 Test

Nov 24, 2010

I have built an ASP.NET (.NET v4) application in VS 2010. It is working just fine. But when I try to create deployment package (so I can deploy it in our test IIS 7.5 Server), it gives me error like this,

Error 1 Could not open Source file: Could not find file 'C:11-2 estobjDebugCSAutoParameterize ransformedWeb.config'. 0 0 test

Thing is in past, I had deployed the SAME application using the SAME method.

View 2 Replies

Web Forms :: Error When Deleting PDF - File Is Used By Another Process

Jun 13, 2012

I have one gridview in that i have three columns "FileName"  "Open" and "Delte" if user Opens clicks on open Pdf file opens in new window that time if user clicks on Delete Button then its giving Error that "Process is using by Some one" ...

View 1 Replies

Application Start In Global.asax File

May 2, 2010

application start in global.asax file

View 6 Replies

Error: File Is Used By Another Process?

Dec 24, 2010

I have Online Exam application when the user has completed his exam is write the question, answer and his result in the excel sheet and store it in server path. The admin has the option to reset the user ie the file gets deleted from the server. It works fine when Admin resets the file after some minutes but if Admin tries to reset the files in as soon as the exam is completed then i get the exception like "File Cannot be deleted since its used by another process" .

1. Will it work when i kill the Excel.exe in the server after the file completes the process or is there any optimul way to do the same.

View 1 Replies

Configuration :: Application To Read A File Which Is Used By Another Process?

Sep 6, 2010

Is it possible for an asp.net application to read a file which is used by another process?

View 9 Replies

Web Forms :: Can't Start File Download From Server Side Using .aspx File In IE7

Mar 26, 2011

This below code i have used in my aspx page for file download.

Response.AppendHeader("content-disposition", "attachment; filename="" + emailAttachment.FileName + "";");
Response.ContentType = "application/octet-stream";
Response.OutputStream.Write(emailAttachment.Data, 0, emailAttachment.Data.Length);
Response.End();

This block of code display Download file Dialog for Open or Save the attached file.It's working fine in Mozila Firefox and IE8 but doesn't display Download file Dialog box in IE 7

View 2 Replies

The Process Cannot Access The File / How To Fix This Error

Oct 24, 2010

I don't know why this does this on the delete.

line 289

The process cannot access the file 'D:InetPubReefJunkiesUsersillProfilePicture Thumb340x_la-rouxsmall.jpg' because it is being used by another process.

Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file 'D:InetPubReefJunkiesUsersillProfilePicture Thumb340x_la-rouxsmall.jpg' because it is being used by another process.

Source Error:

[code]....

View 6 Replies

Subsequent Access To File. Error - The Process Cannot Access File It Is Being Used By Another

Mar 29, 2010

I simply want to create one file and then delete it, means I want to access one file subsequently. I am getting the very familiar error as shown in title. (Process can't access the file,) I have tried using file stream and all other stuff that I found from Googling but no success so far. Does any body have small and neat solution? in short, I would like to run the following statements without any error.File.Create("C:\hsp1.txt");

File.Open("C:\hsp1.txt", FileMode.Open, FileAccess.Read, FileShare.None);

View 2 Replies

Downloading File Process Causing Error?

Mar 11, 2010

In my ASP.Net page, I allow users to download files from the server. If the file is of even a moderate size (does it with a 40 meg file, for example), when downloading, it fails with the error message:

"Insufficient system resources exist to complete the requested service".

I've checked out the server, and it's quiet (CPU, RAM, Hard Drive, Task Manager Processes, etc all very low in their numbers).

I've run the code from several client machines and I'm getting this error message no matter where I run it from.

View 5 Replies

While Trying To Download A File : The Process Cannot Access The File Because It Is Being Used By Another Process

Oct 17, 2010

I am trying to download a file from the server but i am getting this error:

The process cannot access xxxx the file because it is being used by another process

This is my CODE:
string fileName="DownLoadFiles";
string filePath = hid_filepath.Value;
FileInfo file = new FileInfo(filePath);
System.Net.WebClient wc = new System.Net.WebClient();
wc.DownloadFile(new Uri(fileName, filePath);

Foe ur Information:the file is not opened or not used.

View 1 Replies

Configuration :: .tmp File Created After Process Crash When Application Upgraded To 2.0?

Sep 23, 2010

After upgrading an asp.net application to 2.0 from 1.1 I am receiving a large 100+MB .tmp file in C:Temp on the web server when the w3wp process serving that application crashes. If you open the file it looks like it is some sort of dump file. how to turn this off. I know what is crashing the application and process.

View 2 Replies

C# - Load A Definition File At Application Start Located In A Virtual Path?

Jun 28, 2010

How do I load a definition file which contains some start up logic at Application_Start?

I only know the virtual path but not the server physical path. How do I convert the virtual path to server path without Server.MapPath()

I am not sure I can access httpcontext or not in the application start stage.

View 2 Replies

DataSource Controls :: Error 823 / Start SQL Server And Access The MDF File?

Jan 22, 2010

While writing to the SQL Server database, I might encounter the below error message:
"Error 823I/O error <error> detected during <operation> at offset <offset> in file
'<file>'"This error message may occur every time when I start SQL Server and access the MDF file.

View 2 Replies

Web Forms :: The Process Cannot Access The File 'c: Empmy.pdf' Because It Is Being Used By Another Process?

Apr 3, 2010

I've developed a popup email .aspx used on our intranet based web app that is auto generated with .pdf's attached. I'm developing with VS 2008 ASP.Net 3.5 C# and System.Net.Mail.MailMessage. I can create and send the email with no issues. The problem is with any attempt to open or delete the attachments I get the above error. The .pdf's a copied with the following code:

FileStream fsr = new FileStream(inFilename, FileMode.Open, FileAccess.Read, FileShare.Read);
BinaryReader reader = new BinaryReader(fsr);
byte[] bytes = new byte[fsr.Length];
reader.Read(bytes, 0, bytes.Length);
FileStream fsw = new FileStream(outFileName, FileMode.Create, FileAccess.Write, FileShare.Write);
BinaryWriter writer = new BinaryWriter(fsw);
writer.Write(bytes, 0, bytes.Length);
// clean up
writer.Flush();
writer.Close();
writer = null;
fsw.Close();
fsw.Dispose();
fsw = null;
reader.Close();
reader = null;
fsr.Close();
fsr.Dispose();
fsr = null;
Later after sending the email I:
mailMessage.Dispose();
mailMessage = null;
foreach (string fileName in attachments)
{
if (File.Exists(fileName))
File.Delete(fileName);
}

The error occurs at: the File.Delete(fileName);

how I can delete or reopen these files after sending the email?

View 9 Replies

C# - Application Running Under A Less Privileged Account Start A Process Executing Another Application Under An Administrative Account?

Mar 9, 2011

I am logged in as the administrator when I installed an application named pdflatex.exe on my server. This application works as a converter from LaTeX input file to Pdf file. I host an Asp.net MVC 3 application running under an Application Pool Identity with Load User Profile = True. The Asp.net MVC 3 code contains a code that executes pdflatex.exe using System.Diagnostic.Process instance as follows:

Process p = new Process();
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(p_Exited);
p.StartInfo.Arguments = "-interaction=nonstopmode " + inputpath;
p.StartInfo.WorkingDirectory = @"c:mydomain.comworking";
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "pdflatex.exe";
p.Start();
p.WaitForExit();

From the scenario above, the web application runs under a restricted acount but it executes an external application under a default account that I don't know. Can an application running under a less privileged account start a process executing another application under an administrative account?

View 2 Replies

C# - Open File With Its Application?

Aug 27, 2010

want to ask how to open specific file (the file out of the server, i have a relative path to it stored in config file) with its application when click on specific link button or hyper link...like ::open .docx with word.or .pdf with acrobat reader i tried several methods but , i get different errors like "Cannot use a leading .. to exit above the top directory" this my code::

public void ProcessRequest(HttpContext context)
{
int newsId = int.Parse(context.Session["newsId"].ToString());

[code]...

View 2 Replies

Web Forms :: Process Cannot Access The File It Is Being Used By Another Process?

Nov 6, 2010

My code is that I want to create a log file and log it upon a new user browsing the site. However, what i did was I put in a 6 second delay and then used another browser to access the page. And it threw an Exception saying it is being used by another process which is true. So how come I set it so that, if IT is being used by another process, WAIT and retry every 500 milliseconds until it becomes free/available?

here's the code:

protected void Page_Load(object sender, EventArgs e)
{if (!IsPostBack) // if this is the first time page loads, set k to 1
{ lognewuser();
}}

[Code]....

View 1 Replies

Web Forms :: HTTP Error 403 On Clicking Link Button To Open PDF File?

Apr 16, 2010

I'm in a bit of a pickle here. I'm Binding the name of file to a LinkButton and intending to open that file on the LinkButton' click. I have the LinkButton in the TemplateField of a GridView control. Below is the code I'm using : And the Event Handler goes like : protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("goto")) { fileToOpen = e.CommandArgument.ToString(); Response.Redirect(path + fileToOpen); } }

View 3 Replies

Forms Data Controls :: Error When Exporting To Excel - File Trying To Open, '[1].xls, Is In A Different Format

Oct 21, 2010

I have a web page with a gridview control and a button for Exporting to Excel

I get following error when exporting to Excel.

"The file you are trying to open, 'someFileName[1].xls, is in a different format than specified by the file extension. Verify that file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"

Clicking Yes opens the file. I would like to avoid showing the above error to the users.

Following code is used from the click event. I've left the commented code here to show what I've tried based on results from internet search. I have Microsoft Office Excel 2007 on local PC.

[Code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved