473,700 Members | 2,557 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 2578
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
3302
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
2628
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
4309
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
4344
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
10212
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
6909
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
1219
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
1888
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
9217
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
9076
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...
1
8974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6563
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
5903
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3092
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
2392
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2030
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.