Click here to Skip to main content
15,888,113 members
Home / Discussions / C#
   

C#

 
GeneralRe: UWP / VisualStudio 2017 and StackOverflowException Pin
Eddy Vluggen28-Apr-18 6:14
professionalEddy Vluggen28-Apr-18 6:14 
GeneralRe: UWP / VisualStudio 2017 and StackOverflowException Pin
Super Lloyd28-Apr-18 15:56
Super Lloyd28-Apr-18 15:56 
GeneralRe: UWP / VisualStudio 2017 and StackOverflowException Pin
Eddy Vluggen29-Apr-18 0:29
professionalEddy Vluggen29-Apr-18 0:29 
QuestionSend data to remote server using TCPClient Pin
Carmen_Mundi26-Apr-18 8:07
Carmen_Mundi26-Apr-18 8:07 
AnswerRe: Send data to remote server using TCPClient Pin
Richard Deeming26-Apr-18 8:21
mveRichard Deeming26-Apr-18 8:21 
GeneralRe: Send data to remote server using TCPClient Pin
Carmen_Mundi26-Apr-18 8:55
Carmen_Mundi26-Apr-18 8:55 
GeneralRe: Send data to remote server using TCPClient Pin
Gerry Schmitz26-Apr-18 10:25
mveGerry Schmitz26-Apr-18 10:25 
QuestionCould not find a part of the path c# in Internet explorer Pin
Member 1204569226-Apr-18 1:29
Member 1204569226-Apr-18 1:29 
I have a webpage that Is hosted on a IIS-server. When I use Internet explorer to upload files, I get the following error:

<System.Exception: System.Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\brkar1\Downloads\dokumentation.docx'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)<br />
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)<br />
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)<br />
at System.IO.File.InternalWriteAllBytes(String path, Byte[] bytes, Boolean checkHost) at System.IO.File.WriteAllBytes(String path, Byte[] bytes) at OrderForm.Service.Services.FileService.d__0.MoveNext() in C:\Git-new\devteam\web-applications\ICOM.OrderForm\OrderForm.Service\Services\F


However, If I use firefox, It works just fine.

If I start the project localy in IIS-express, I don't get any exception, but the file Is still not uploaded.

Here Is my code for uploading:

OrderController.cs:
C#
var keys = Request.Form.AllKeys;
            var jsonData = Request.Form.Get(keys[0]);
            var files = this.Request.Files;
        List<FileModel> fileData = new List<FileModel>();
        if (files.Count > 0)
        {
            for (var i = 0; i < files.Count; i++)
            {
                FileModel fileModel = new FileModel();
                HttpPostedFileBase file = files[i];
                BinaryReader b = new BinaryReader(file.InputStream);
                fileModel.data = b.ReadBytes(file.ContentLength);
                fileModel.FileName = file.FileName;

                fileData.Add(fileModel);
            }

        }
var result = await orderService.Create(orderModel, fileData.Count() > 0 ? fileData : null);


Orderservice:
C#
if (files.Count() > 0 && orderNo > 0)
                {
                    var folder = ConfigurationManager.AppSettings["AttachmentFolder"] + "\\" + orderNo;

                    if (Directory.Exists(folder) == false)
                    {
                        Directory.CreateDirectory(folder);
                    }

                    foreach (var file in files)
                    {
                        FileModel newFile = new FileModel();
                        var fileName = file.FileName;
                        var filePath = Path.Combine(folder, fileName);
                        File.WriteAllBytes(filePath, file.data); //This seem to not work when using Internet Explorer

                        newFile.FileName = fileName;
                        newFile.FileUrl = filePath;
                        filesWithPath.Add(newFile);
                    }

                    return filesWithPath;
                }


ConfigurationManager.AppSettings["AttachmentFolder"] + "\\" + orderNo is just a folder where the file should be saved In.
AnswerRe: Could not find a part of the path c# in Internet explorer Pin
Richard Deeming26-Apr-18 3:14
mveRichard Deeming26-Apr-18 3:14 
Questiondisabling a textbox at intialization in wpf/C# Pin
jhoga25-Apr-18 4:27
jhoga25-Apr-18 4:27 
AnswerRe: disabling a textbox at intialization in wpf/C# Pin
Richard MacCutchan25-Apr-18 5:04
mveRichard MacCutchan25-Apr-18 5:04 
GeneralRe: disabling a textbox at intialization in wpf/C# Pin
jhoga25-Apr-18 5:15
jhoga25-Apr-18 5:15 
GeneralRe: disabling a textbox at intialization in wpf/C# Pin
jhoga25-Apr-18 5:50
jhoga25-Apr-18 5:50 
QuestionHow to delete row(s) from a database view and two of the linked tables? Pin
Member 1378393524-Apr-18 21:58
Member 1378393524-Apr-18 21:58 
AnswerRe: How to delete row(s) from a database view and two of the linked tables? Pin
Richard Deeming25-Apr-18 1:31
mveRichard Deeming25-Apr-18 1:31 
AnswerRe: How to delete row(s) from a database view and two of the linked tables? Pin
Gerry Schmitz25-Apr-18 6:17
mveGerry Schmitz25-Apr-18 6:17 
Questionabsolute-text-location-multiline Pin
Member 1368201324-Apr-18 19:23
Member 1368201324-Apr-18 19:23 
AnswerRe: absolute-text-location-multiline Pin
BillWoodruff24-Apr-18 22:28
professionalBillWoodruff24-Apr-18 22:28 
QuestionSubscribe to an event through COM GetEvent return null Pin
aymen Tn24-Apr-18 5:45
aymen Tn24-Apr-18 5:45 
AnswerRe: Subscribe to an event through COM GetEvent return null Pin
Gerry Schmitz24-Apr-18 7:34
mveGerry Schmitz24-Apr-18 7:34 
GeneralRe: Subscribe to an event through COM GetEvent return null Pin
aymen Tn24-Apr-18 22:05
aymen Tn24-Apr-18 22:05 
QuestionTransfer and synchronize sqlite db to android device Pin
Member 1053274823-Apr-18 11:14
Member 1053274823-Apr-18 11:14 
AnswerRe: Transfer and synchronize sqlite db to android device Pin
Maciej Los23-Apr-18 20:12
mveMaciej Los23-Apr-18 20:12 
QuestionHow to Get Values from XML in COMBO BOX Pin
Member 1377710422-Apr-18 17:10
Member 1377710422-Apr-18 17:10 
AnswerRe: How to Get Values from XML in COMBO BOX Pin
OriginalGriff22-Apr-18 20:01
mveOriginalGriff22-Apr-18 20:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.