By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,027 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,027 IT Pros & Developers. It's quick & easy.

File Delete: Path is to long

P: n/a
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.PathTooLongException: 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.MapPath("..\\UploadImg" + "\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line: 93

Stack Trace:
[PathTooLongException: The path is too long after being fully qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[] invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender, DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93

System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source, EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)

System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()

the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];

clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();

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

Can someone tell me what is going wrong here?
Nov 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Wow, that stinks. I don't have a good answer, but I wonder if you get the
same behavior if you call:

new FileInfo(fileName).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.PathTooLongException: 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.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93

Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEven
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?


Nov 19 '05 #2

P: n/a
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(fileName).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.PathTooLongException: 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.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93

Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEven
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").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

P: n/a
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(fileName).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.PathTooLongException: 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.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93

Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEven
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:

public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?


Nov 19 '05 #4

P: n/a
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(fileName).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.PathTooLongException: 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.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93
Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEv
en
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHan
dl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:
public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?


Nov 19 '05 #5

P: n/a
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(fileName).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.PathTooLongException: 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.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93
Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEv
en
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHan
dl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:
public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?


Nov 19 '05 #6

P: n/a
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(fileName).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.PathTooLongException: 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.MapPath("..\\UploadImg" +
"\\").ToString();
Line 93: File.Delete( UpPath + fileDeleteRead["ImgName"]);
Line 94: }
Line 95: fileDeleteRead.Close();
Source File: c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs Line:
93
Stack Trace:

[PathTooLongException: The path is too long after being fully
qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator,
Char volumeSeparator, Boolean fullCheck, String& newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.File.Delete(String path) +33
Sonar3.Secured.EVNR.Delete_Click(Object sender,
DataGridCommandEventArgs
e) in c:\inetpub\wwwroot\sonar3\secured\evnr.aspx.cs:93
System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEv
en
tArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source,
EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHan
dl
er.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
the code this is refering to is as follows:
public void Delete_Click(object sender, DataGridCommandEventArgs e)
{
int EditID=(int)clubdg1.DataKeys[(int)e.Item.ItemIndex];
clubconn=new SqlConnection(strClubconnect);
clubconn.Open();
filedeletecmd=new SqlCommand("SELECT img_tbl.* FROM img_tbl WHERE
EVNRID=" + EditID, clubconn);
fileDeleteRead=filedeletecmd.ExecuteReader();
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
It is refering to the section in particular :
while(fileDeleteRead.Read())
{
string UpPath=Server.MapPath("..\\UploadImg" + "\\").ToString();
File.Delete( UpPath + fileDeleteRead["ImgName"]);
}
fileDeleteRead.Close();
clubconn.Close();
Can someone tell me what is going wrong here?


Nov 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.