I am currently having a problem when uploading a file using a file upload control in asp.net
I have published my page using IIS on a remote server and I am accessing that link on my local computer.
Currently when im trying to upload a file I get an error saying that path not found meaning its looking for the file path that is on my pc, on the server which of course doesn't exist.
How do I get this to get the path from my pc because im trying to copy/saveAs the file from my pc to the server.
My code:
String pathCombine = System.IO.Path.Combine(destinationDirectory, Path.GetFileName(file));
File.Copy(sourcePath, pathCombine);
Related
I have uploaded a site on azure using shared service plan.Whenever i try to download any excel file i get below error.
The process cannot access the file 'D:\home\site\wwwroot' because it is being used by another process.
I have used below download code to get fileLocation: HostingEnvironment.MapPath(#"~/Files/" + FileName)
It is working fine on my local environment. Issue only arises if i do the download from the hosted site.
Here i am trying to save excel file at specific path using COM.
In a local server it is working but when I user IIS server to run asp.net web application it is showing an error message as per heading.
string selected_sheet =
DropDownList1.SelectedValue.Remove(DropDownList1.SelectedValue.IndexOf("$"));
string path = Server.MapPath("~/Data/");
xlWorkBook.SaveAs(path + selected_sheet);
I am facing issue in my web application which is made in asp.net. I have host the application on IIS server.and I am going to upload excel file to port data in database from application.when i uploading from locally from server itself its working fine but i when i try to uploading using public ip or outside then my application redirect to IIS root folder can any one tell me whats is the issue.
this could be an permission issue on your web.config, file and folder permission or maybe a missing reference to correct folder.
Web.config
What is the authentication ? Do you allow Anonymous access. I understand that you can upload fine if you open the side from localhost from the server itself. Did you try to open the side with public ip from the server itself ?
Application Pool in IIS
Look for the "Identify" configuration and set this to "ApplicationPoolIdentify"
File Permission
Look for the folder and ensure that the "IIS_IUSERS" got write permissions
Code Try to sepecify the correct path using the server.MapPath()
Dim myPath As String = Server.MapPath("foldername") & "\" & "filename.csv"
How to construct root path from registry editor when execute program in web server,while executing in local path i am getting as ""C:\Users\Desktop\SPHelper.exe" "%1"" but in web server i am getting in this format ""webserver\Dot net upload\SPHelper.exe" "%1".
How to construct root path in web server in complete format? for example("\\webserver\Dot net upload\SPHelper.exe""%1")
Hi We can use this to find the Location
System.Reflection.Assembly.GetExecutingAssembly().Location
After making a published version of asp.net webform application and uploading it to my clients server the application worked correctly.
But after time it showed this error:
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at LogisticSystem.eokReports.ExportReportPage.GetReport()
in D:\Mostafa\LogisticSystem\LogisticSystem\eokReports\ExportReportPage.aspx.cs:line 390
this path is my local pc path
"D:\Mostafa\LogisticSystem\LogisticSystem\eokReports\ExportReportPage.aspx.cs" not a path at the clients server
It looks like you are trying to load a file that is not present at the clients server. Make sure that your report path is correct and the file exists. If "D:\Mostafa\LogisticSystem\LogisticSystem\eokReports\ExportReportPage.aspx.cs" not a path at the clients server is your error, then it's pretty clear that the file path you specify in your code does not exist on the server. Put the report file on the client's server and change your code to point to that file location instead of the location on YOUR machine.
Hope that helps,
Chris