473,756 Members | 6,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Delete: Path is to long

I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is less
than 260 characters.

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

Exception Details: System.IO.PathT ooLongException : The path is too long
after being fully qualified. Make sure path is less than 260 characters.

Source Error:
Line 91: {
Line 92: string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead. Close();
Source File: c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s Line: 93

Stack Trace:
[PathTooLongExce ption: The path is too long after being fully qualified.
Make sure path is less than 260 characters.]
System.IO.Path. nGetFullPathHel per(String path, Char[] invalidPathChar s,
Char[] whitespaceChars , Char directorySepara tor, Char altDirectorySep arator,
Char volumeSeparator , Boolean fullCheck, String& newPath) +0
System.IO.Path. GetFullPathInte rnal(String path) +165
System.IO.File. Delete(String path) +33
Sonar3.Secured. EVNR.Delete_Cli ck(Object sender, DataGridCommand EventArgs
e) in c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s:93

System.Web.UI.W ebControls.Data Grid.OnDeleteCo mmand(DataGridC ommandEventArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source, EventArgs
e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source,
EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)

System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()

the code this is refering to is as follows:

public void Delete_Click(ob ject sender, DataGridCommand EventArgs e)
{
int EditID=(int)clu bdg1.DataKeys[(int)e.Item.Ite mIndex];

clubconn=new SqlConnection(s trClubconnect);
clubconn.Open() ;
filedeletecmd=n ew SqlCommand("SEL ECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead= filedeletecmd.E xecuteReader();
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );

It is refering to the section in particular :
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );

Can someone tell me what is going wrong here?
Nov 19 '05 #1
6 2585
Wow, that stinks. I don't have a good answer, but I wonder if you get the
same behavior if you call:

new FileInfo(fileNa me).Delete();

-Brock
DevelopMentor
http://staff.develop.com/ballen
I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

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

Exception Details: System.IO.PathT ooLongException : The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.M apPath("..\\Upl oadImg" +
"\\").ToString( );
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead. Close();
Source File: c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s Line:
93

Stack Trace:

[PathTooLongExce ption: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path. nGetFullPathHel per(String path, Char[]
invalidPathChar s,
Char[] whitespaceChars , Char directorySepara tor, Char
altDirectorySep arator,
Char volumeSeparator , Boolean fullCheck, String& newPath) +0
System.IO.Path. GetFullPathInte rnal(String path) +165
System.IO.File. Delete(String path) +33
Sonar3.Secured. EVNR.Delete_Cli ck(Object sender,
DataGridCommand EventArgs
e) in c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s:93
System.Web.UI.W ebControls.Data Grid.OnDeleteCo mmand(DataGridC ommandEven
tArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source,
EventArgs
e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source,
EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandl
er.RaisePostBac kEvent(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
the code this is refering to is as follows:

public void Delete_Click(ob ject sender, DataGridCommand EventArgs e)
{
int EditID=(int)clu bdg1.DataKeys[(int)e.Item.Ite mIndex];
clubconn=new SqlConnection(s trClubconnect);
clubconn.Open() ;
filedeletecmd=n ew SqlCommand("SEL ECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead= filedeletecmd.E xecuteReader();
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
It is refering to the section in particular :
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
Can someone tell me what is going wrong here?


Nov 19 '05 #2
I don't have time to look it up now, but is there a way to convert the path
and file to the "short filename" format?

Brock Allen wrote:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileNa me).Delete();

-Brock
DevelopMentor
http://staff.develop.com/ballen
I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

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

Exception Details: System.IO.PathT ooLongException : The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.M apPath("..\\Upl oadImg" +
"\\").ToString( );
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead. Close();
Source File: c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s Line:
93

Stack Trace:

[PathTooLongExce ption: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path. nGetFullPathHel per(String path, Char[]
invalidPathChar s,
Char[] whitespaceChars , Char directorySepara tor, Char
altDirectorySep arator,
Char volumeSeparator , Boolean fullCheck, String& newPath) +0
System.IO.Path. GetFullPathInte rnal(String path) +165
System.IO.File. Delete(String path) +33
Sonar3.Secured. EVNR.Delete_Cli ck(Object sender,
DataGridCommand EventArgs
e) in c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s:93
System.Web.UI.W ebControls.Data Grid.OnDeleteCo mmand(DataGridC ommandEven
tArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source,
EventArgs
e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source,
EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandl
er.RaisePostBac kEvent(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
the code this is refering to is as follows:

public void Delete_Click(ob ject sender, DataGridCommand EventArgs e)
{
int EditID=(int)clu bdg1.DataKeys[(int)e.Item.Ite mIndex];
clubconn=new SqlConnection(s trClubconnect);
clubconn.Open() ;
filedeletecmd=n ew SqlCommand("SEL ECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead= filedeletecmd.E xecuteReader();
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
It is refering to the section in particular :
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
Can someone tell me what is going wrong here?


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 19 '05 #3
ha ha Brock "Wow, that stings" isn't the kind of answer I like reading.
Rather discouraging. I looked all over the web for an answer to that and I
pretty well get the same answer. Microsoft put a cap on the character size
of any variable being stuffed into a path. I think I have to find the
directory and tell the application delete xfile from that directory but I
don't know how. Anyhow, I'll try your suggestion. Thank you for responding
so quick.

Sam-

"Brock Allen" wrote:
Wow, that stinks. I don't have a good answer, but I wonder if you get the
same behavior if you call:

new FileInfo(fileNa me).Delete();

-Brock
DevelopMentor
http://staff.develop.com/ballen
I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

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

Exception Details: System.IO.PathT ooLongException : The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.M apPath("..\\Upl oadImg" +
"\\").ToString( );
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead. Close();
Source File: c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s Line:
93

Stack Trace:

[PathTooLongExce ption: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path. nGetFullPathHel per(String path, Char[]
invalidPathChar s,
Char[] whitespaceChars , Char directorySepara tor, Char
altDirectorySep arator,
Char volumeSeparator , Boolean fullCheck, String& newPath) +0
System.IO.Path. GetFullPathInte rnal(String path) +165
System.IO.File. Delete(String path) +33
Sonar3.Secured. EVNR.Delete_Cli ck(Object sender,
DataGridCommand EventArgs
e) in c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s:93
System.Web.UI.W ebControls.Data Grid.OnDeleteCo mmand(DataGridC ommandEven
tArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source,
EventArgs
e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source,
EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandl
er.RaisePostBac kEvent(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
the code this is refering to is as follows:

public void Delete_Click(ob ject sender, DataGridCommand EventArgs e)
{
int EditID=(int)clu bdg1.DataKeys[(int)e.Item.Ite mIndex];
clubconn=new SqlConnection(s trClubconnect);
clubconn.Open() ;
filedeletecmd=n ew SqlCommand("SEL ECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead= filedeletecmd.E xecuteReader();
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
It is refering to the section in particular :
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
Can someone tell me what is going wrong here?


Nov 19 '05 #4
I looked for this but couldn't find a managed API for it. That's why I said
"this stinks". Though, I didn't look very hard.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I don't have time to look it up now, but is there a way to convert the
path and file to the "short filename" format?

Brock Allen wrote:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileNa me).Delete();

-Brock
DevelopMentor
http://staff.develop.com/ballen
I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

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

Exception Details: System.IO.PathT ooLongException : The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.M apPath("..\\Upl oadImg" +
"\\").ToString( );
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead. Close();
Source File: c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s Line:
93
Stack Trace:

[PathTooLongExce ption: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path. nGetFullPathHel per(String path, Char[]
invalidPathChar s,
Char[] whitespaceChars , Char directorySepara tor, Char
altDirectorySep arator,
Char volumeSeparator , Boolean fullCheck, String& newPath) +0
System.IO.Path. GetFullPathInte rnal(String path) +165
System.IO.File. Delete(String path) +33
Sonar3.Secured. EVNR.Delete_Cli ck(Object sender,
DataGridCommand EventArgs
e) in c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s:93
System.Web.UI.W ebControls.Data Grid.OnDeleteCo mmand(DataGridC ommandEv
en
tArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source,
EventArgs
e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source,
EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHan
dl
er.RaisePostBac kEvent(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
the code this is refering to is as follows:
public void Delete_Click(ob ject sender, DataGridCommand EventArgs e)
{
int EditID=(int)clu bdg1.DataKeys[(int)e.Item.Ite mIndex];
clubconn=new SqlConnection(s trClubconnect);
clubconn.Open() ;
filedeletecmd=n ew SqlCommand("SEL ECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead= filedeletecmd.E xecuteReader();
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
It is refering to the section in particular :
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
Can someone tell me what is going wrong here?


Nov 19 '05 #5
Thanks for trying anyhow. I'm going to stew on this problem for a bit. I'll
let you know if I figure anything out.

"Brock Allen" wrote:
I looked for this but couldn't find a managed API for it. That's why I said
"this stinks". Though, I didn't look very hard.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I don't have time to look it up now, but is there a way to convert the
path and file to the "short filename" format?

Brock Allen wrote:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileNa me).Delete();

-Brock
DevelopMentor
http://staff.develop.com/ballen
I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

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

Exception Details: System.IO.PathT ooLongException : The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.M apPath("..\\Upl oadImg" +
"\\").ToString( );
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead. Close();
Source File: c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s Line:
93
Stack Trace:

[PathTooLongExce ption: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path. nGetFullPathHel per(String path, Char[]
invalidPathChar s,
Char[] whitespaceChars , Char directorySepara tor, Char
altDirectorySep arator,
Char volumeSeparator , Boolean fullCheck, String& newPath) +0
System.IO.Path. GetFullPathInte rnal(String path) +165
System.IO.File. Delete(String path) +33
Sonar3.Secured. EVNR.Delete_Cli ck(Object sender,
DataGridCommand EventArgs
e) in c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s:93
System.Web.UI.W ebControls.Data Grid.OnDeleteCo mmand(DataGridC ommandEv
en
tArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source,
EventArgs
e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source,
EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHan
dl
er.RaisePostBac kEvent(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
the code this is refering to is as follows:
public void Delete_Click(ob ject sender, DataGridCommand EventArgs e)
{
int EditID=(int)clu bdg1.DataKeys[(int)e.Item.Ite mIndex];
clubconn=new SqlConnection(s trClubconnect);
clubconn.Open() ;
filedeletecmd=n ew SqlCommand("SEL ECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead= filedeletecmd.E xecuteReader();
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
It is refering to the section in particular :
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
Can someone tell me what is going wrong here?


Nov 19 '05 #6
ha ha I figured out what the damn problem is.
Everytime I load the file path, the file name and the file type, somehow
some way extra white space gets dumped into the database in sqlserver(I have
no idea why). when I set a breakpoint at the beginning of the string I
noticed the whitespace. So I typed trim() at the end of each string and it
worked.

Thank you for Brock and Bob for helping.

Sam-

"Brock Allen" wrote:
I looked for this but couldn't find a managed API for it. That's why I said
"this stinks". Though, I didn't look very hard.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I don't have time to look it up now, but is there a way to convert the
path and file to the "short filename" format?

Brock Allen wrote:
Wow, that stinks. I don't have a good answer, but I wonder if you get
the same behavior if you call:

new FileInfo(fileNa me).Delete();

-Brock
DevelopMentor
http://staff.develop.com/ballen
I keep getting this error and I don't know why:

The path is too long after being fully qualified. Make sure path is
less than 260 characters.

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

Exception Details: System.IO.PathT ooLongException : The path is too
long after being fully qualified. Make sure path is less than 260
characters.

Source Error:

Line 91: {
Line 92: string UpPath=Server.M apPath("..\\Upl oadImg" +
"\\").ToString( );
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead. Close();
Source File: c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s Line:
93
Stack Trace:

[PathTooLongExce ption: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path. nGetFullPathHel per(String path, Char[]
invalidPathChar s,
Char[] whitespaceChars , Char directorySepara tor, Char
altDirectorySep arator,
Char volumeSeparator , Boolean fullCheck, String& newPath) +0
System.IO.Path. GetFullPathInte rnal(String path) +165
System.IO.File. Delete(String path) +33
Sonar3.Secured. EVNR.Delete_Cli ck(Object sender,
DataGridCommand EventArgs
e) in c:\inetpub\wwwr oot\sonar3\secu red\evnr.aspx.c s:93
System.Web.UI.W ebControls.Data Grid.OnDeleteCo mmand(DataGridC ommandEv
en
tArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source,
EventArgs
e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source,
EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs
args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHan
dl
er.RaisePostBac kEvent(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
the code this is refering to is as follows:
public void Delete_Click(ob ject sender, DataGridCommand EventArgs e)
{
int EditID=(int)clu bdg1.DataKeys[(int)e.Item.Ite mIndex];
clubconn=new SqlConnection(s trClubconnect);
clubconn.Open() ;
filedeletecmd=n ew SqlCommand("SEL ECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead= filedeletecmd.E xecuteReader();
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
It is refering to the section in particular :
while(fileDelet eRead.Read())
{
string UpPath=Server.M apPath("..\\Upl oadImg" + "\\").ToString( );
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead. Close();
clubconn.Close( );
Can someone tell me what is going wrong here?


Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1113
by: matt dittman | last post by:
I have created a windows service that reads emails from a drop directory and moves them to the appropriate mail folder every 15 seconds. I can move, rename and delete the files as needed, up until the CDO.DropDirectory.GetMessages() method is called. At this point, the files are locked until I shut down the service. After processing and delivery, I need to be able to delete all the files in the drop directory. I can delete them via...
5
3305
by: Scott Tilton | last post by:
I am having a terrible time getting this to work. I am hoping someone out there can help me with very specific code examples. I am trying to get the linked tables in my Access 97 database to be updated whenever the database opens. I need to have them updated based on an INI file that resides in the same directory as the current database. I do not need or want the ability to open a dialog box to pick the location. I simply want it to...
4
2636
by: dixie | last post by:
Help, I'm really out of my depth here (not unusual I hear you say :-). I have just installed HTML Help in an application. I told it in the Project Properties the path to the help file. I then type in a command line that runs the help in the correct Context from a button on each form. It all worked fine - HERE. The problem is that when I sent it out to a site, the help file was not able to be accessed because it was my path in the...
13
4320
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
18
4350
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't get it to upload a file to the FTP server. I just get a "Cannot connect to remote server" error after this TRY: s = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
6
10217
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error message: "The process cannot access the file "whatever" because it is being used by another process." I've even tried opening another file using the same streamwriter object before deleting the original file, but it's no use. Something keeps...
4
6916
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in path" The value "C:\Temp.txt" is the first value in the array - as it works
4
1220
by: cmdolcet69 | last post by:
I have the below code that calls a function to delete a file that i added to a listview node. What happens is that that file doesn;t delete. Please help me out. I have included the event handler and function. Thanks Private Sub btnDeleteReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteReport.Click
2
1889
by: brixton | last post by:
Hello, I've got the following code: wxString path = filepath; wxString newpath = filepath; fstream f(path.Append("/tests/tests.bin"), ios::in | ios::binary); fstream fnew(newpath.Append("/tests/temp.bin"), ios::out | ios::binary); Test* transferTest = new Test(); int thisSize = sizeof(Test); bool success = false; bool toBeDeleted = false;
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10028
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9868
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9707
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3352
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2664
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.