本文介绍了在ASP.net网站中搜索文件的优化和有效方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在开发一个网站,必须在其中提供搜索功能
位于两个给定路径(例如"D:\ MyWeb1 \"和"D:\ MyWeb2")的文件.

我在网上搜索后发现以下代码段

Hi All

I am developing a website in which I have to provide a feature to serach
files which are at two given paths (say "D:\MyWeb1\" and "D:\MyWeb2").

I searched on net and found below code snippet

void DirSearch(string sDir)
{
    try
    {
       foreach (string d in Directory.GetDirectories(sDir))
       {
        foreach (string f in Directory.GetFiles(d, txtFile.Text))
        {
           lstFilesFound.Items.Add(f);
        }
        DirSearch(d);
       }
    }
    catch (System.Exception excpt)
    {
        Console.WriteLine(excpt.Message);
    }
}



在其中一个站点上,我遇到了代码,该代码创建了两个线程以在两个文件夹中进行搜索,然后组合结果以进行快速搜索.
然后我想到了几个问题
1.在ASP.net网站中创建线程以搜索文件是否很好?
2.如果进行搜索的用户数量增加,将会发生什么
网站的性能如何?
3.我应该使用AJAX来实现它吗?
4.有没有更好的方法来搜索ASP.net网站的文件?

请提出一种在ASP.net网站上搜索文件的方法.

在此先感谢:)

SK



And on one of the sites I came across code which created two threads to search in two folders and then combine the results for fast searching.
And then few question came up in my mind
1. Is it good to make threads in ASP.net website to search in files?
2. If the number of users making the search increases what will happen
to the performance of my site?
3. SHould I implement it using AJAX?
4. Is there any better way to search in a file for ASP.net website?

Please suggest a approach for searching a file in ASP.net website.

Thanks in advance :)

THE SK

推荐答案



这篇关于在ASP.net网站中搜索文件的优化和有效方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 05:06