G
Guest
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(Object source, EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 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?
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(Object source, EventArgs
e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source,
EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 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?