Advertisement

02.18.2008 at 09:05PM PST, ID: 23173470
[x]
Attachment Details

Illegal characters in path.  --  runtime error

Asked by amillyard in Microsoft Visual C#.Net, .NET Framework 2.0, Visual Studio 2008

Tags: c#, asp.net 2.x, vs 2008 pro, sql 2005 server

I am getting the following runtime error (within browser)

Illegal characters in path

Have using the trim and no trim options to see if there were any additional characters within string that way that might be causing an issue.

What sort of characters can cause this type of error?
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
protected void AJAXUploader1_FileUploaded1(object sender, EventArgs e)
        {
            EO.Web.AJAXPostedFile[] files = AJAXUploader1.PostedFiles;
 
            string s = string.Empty;
 
            foreach (EO.Web.AJAXPostedFile file in files)
            {
                s += System.IO.Path.GetFileName(file.TempFileName);
                s += "<br />";
            }
 
            lblFiles.Text = s;
 
            //string path1 = @"D:\Inetpub\docs\Upload\" + s.Trim();
            //string path2 = @"D:\Inetpub\docs\UploadDestination\" + s.Trim();
 
            string path1 = @"D:\Inetpub\docs\Upload\" + s;
            string path2 = @"D:\Inetpub\docs\UploadDestination\" + s;
 
            if (!File.Exists(path1))
            {
                using (FileStream fs = File.Create(path1)) { }
            }
 
            if (File.Exists(path2))
                File.Delete(path2);
 
            File.Move(path1, path2);  
        }
[+][-]02.18.2008 at 10:55PM PST, ID: 20926283

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, .NET Framework 2.0, Visual Studio 2008
Tags: c#, asp.net 2.x, vs 2008 pro, sql 2005 server
Sign Up Now!
Solution Provided By: SteveH_UK
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.19.2008 at 01:17AM PST, ID: 20926784

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628