Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0System.Threading.ThreadAbortException: Thread was being aborted.System.Threading.ThreadAbortException: Thread was being aborted.
Previous
 
Next
New Post
8/27/2008 7:42 PM
 

I've a .net 2.0 app.  One of the pages contains a treeview control that displays folders on the c: drive.  

The following code snippet shows how I populate the nodes of the treeview with the folders and files.  

When a document link is highlighted it shows the following code:
__doPostBack('ctl00$ContentPlaceHolder1$TreeView1','sC:*|*MainFolder*|*SubFolder*|*\\C:*|*MainFolder*|*SubFolder*|*SubSubFolder/\\C:*|*MainFolder*|*SubFolder*|*SubSubFolder/AnotherFolder/\\C:*|*MainFolder*|*SubFolder*|*SubSubFolder*|*AnotherFolder*|*doc.pdf')

On my local computer the documents open no problem, however on the server it has issues understanding this complex string of information to locate and open the file.  What can I do to correct this issue?

 

foreach (DirectoryInfo subFolder in subFolders)
           
{
               
TreeNode child = AddNodeAndDescendents(subFolder, node);
                child
.Text = subFolder.Name + " - last modified on " + subFolder.LastWriteTime;
 
               
foreach (FileInfo file in subFolder.GetFiles())
               
{
 
                   
int index = file.FullName.LastIndexOf("\\");
                   
string strname = file.FullName.Substring(index + 1);
                   
string[] name = strname.Split('.');
 
                   
TreeNode tn = new TreeNode();
                    tn
= new TreeNode(name[0], file.FullName);
 
                    tn
.Text = "last modified on " + file.LastWriteTime + "<table style='border:0px; border-collapse:collapse;'><tr><td style='width:600px' nowrap> " + file.Name + " " + file.Length.ToString() + " bytes</td></tr></table>";
 
                    child
.ChildNodes.Add(tn);
 
               
}
 
                node
.ChildNodes.Add(child);
           
}
 
New Post
8/27/2008 10:05 PM
 

Are you 100% certain this is where the failure is occurring?  I've seen the ThreadAbortException more in conjunction with AJAX calls (through UpdatePanels) and with Response.Redirect (where it forces the response object closed but it wasn't/isn't ready to be closed yet and ends up throwing an exception).


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
8/28/2008 9:14 PM
 

Frankly, I'm not sure of anything.  I've been working to resolve this problem for days now and can't figure it out.  Here's the latest:

Let me say that I've tried to resolve the issue with not using response.redirect (and any other suggested solutions out there that are similar) but this has not resolved the issue.

When a document link is clicked in the treeview control the document opens just fine if the app is run in VS2008 however when run through IIS I get the error mentioned in the subject line.  When running the app through VS2008 the docs open fine however the Output window does show the same error message.  

See my complete code below.

 

private const string VirtualFolderRoot = @"D:\afolder\";
 
    protected void Page_Load(object sender, EventArgs e)
    {
 
 
        //if (!Request.IsAuthenticated)
        if (!User.Identity.IsAuthenticated)
 
            formsAuthentication.RedirectToLoginPage();
        //tells browser not to cache the page
        this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
 
 
 
        if (!IsPostBack)
            PopulateTree();
 
        if (DropDownList1.SelectedItem.Value.Equals("
aselection"))
        {
            Server.Execute("
~/default.aspx", false);
        }
 
 
    }
 
    private void PopulateTree()
    {
        //Populate the tree based on the subfolders of the specified VirtualFolderRoot
 
        DirectoryInfo rootFolder = new DirectoryInfo(VirtualFolderRoot);
        TreeNode root;
 
 
        root = AddNodeAndDescendents(rootFolder, null);
        //Add the root to the TreeView
        TreeView1.Nodes.Add(root);
 
 
 
    }
 
 try
        {
 
            //Recurse through this folder's subfolders
            DirectoryInfo[] subFolders = folder.GetDirectories();
 
            foreach (DirectoryInfo subFolder in subFolders)
            {
                TreeNode child = AddNodeAndDescendents(subFolder, node);
                child.Text = subFolder.Name + "
- last modified on " + subFolder.LastWriteTime;
 
                foreach (FileInfo file in subFolder.GetFiles())
                {
 
                    int index = file.FullName.LastIndexOf("
\\");
                    string strname = file.FullName.Substring(index + 1);
                    string[] name = strname.Split('.');
 
                    TreeNode tn = new TreeNode();
                    tn = new TreeNode(name[0], file.FullName);
 
                    tn.Text = "
last modified on " + file.LastWriteTime + "<table style='border:0px; border-collapse:collapse;'><tr><td style='width:600px' nowrap> " + file.Name + " " + file.Length.ToString() + " bytes</td></tr></table>";
 
                    child.ChildNodes.Add(tn);
 
                }
 
                node.ChildNodes.Add(child);
            }
        }
        catch (System.IO.IOException e)
        {
 
            if (e is FileNotFoundException)
            {
                Console.WriteLine(e.Message);
 
            }
            else if (e is DirectoryNotFoundException)
            {
                Console.WriteLine(e.Message);
 
            }
 
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
 
        //Return the new TreeNode
        return node;
 
 
    }
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
    {
        try
        {
            string strPath = "
\"" + this.TreeView1.SelectedNode.Value + "\"";
            lblinfo
.Text = strPath;
           
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
            myProcess
.EnableRaisingEvents = false;
            myProcess
.StartInfo.FileName = strPath;
         
            myProcess
.Start();
 
 
       
}
       
catch (Exception ex)
       
{
           
Response.Write(ex.Message);
           
TreeView1.Visible = false;
       
}
   
}
 
New Post
8/29/2008 9:29 AM
 

For debugging purposes, try wrapping the contents of Page_Load with a try{}catch{} block and see if you can capture an error in there and write it to the eventlog or elsewhere.  Looking through the code I can't see anywhere else that would cause the error (or at least come back without catching it, since you have some try{}catch{} inside there where it might have a System.IO.IOException... except perhaps the first call to DirectoryInfo... that might possibly throw an exception if it doesn't have access to the folder, though in this case that isn't the error you are receiving. 

Anyway, try that try{}catch{} in your Page_Load and see if that gives you some additional info and a stack trace so you can find out where the error is occurring.  Good luck tracing it!


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0System.Threading.ThreadAbortException: Thread was being aborted.System.Threading.ThreadAbortException: Thread was being aborted.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out