如何在不使用数据库的情况下从asp.net网站上搜索网页 [英] how to search from a webpages from asp.net website without using database

查看:73
本文介绍了如何在不使用数据库的情况下从asp.net网站上搜索网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个静态网站有15页..我没有在我的网站上使用任何数据库。



i希望搜索网站上的所有链接并重定向到那个页面..



我将如何表演..请给我建议..



谢谢提前

解决方案

Hello Dude,



您可以在代码中创建DataTable自己创建数据表将值存储到datatable并处理它



 DataTable dt = new DataTable(); 
dt.Columns.AddRange(new DataColumn [3] {new DataColumn(Id,typeof(int)),
new DataColumn(PageName,typeof(string)),
new DataColumn(PageUrl,typeof(string))});
dt.Rows.Add(1,Page1,Page1.aspx);
dt.Rows.Add(2,Page2,Page2.aspx);
dt.Rows.Add(3,Page3,Page3.aspx);
dt.Rows.Add(4,Page4,Page4.aspx);


试试这个:



 < span class =code-keyword> string  filename =   Formame.aspx; 
string name = Request.PhysicalApplicationPath + Foldername \\ + filename;
bool status = System.IO.File.Exists(name);
if (status == true
{
// 您的COde
}
其他
{
// 您的代码
}


i have a static website have 15 pages.. i am not using any database in my website.

i want to search all links from the website and also redirect to that page..

how i will perform .. please give me suggestion..

thanks in advance

解决方案

Hello Dude,

You can create DataTable in code behaind it self just create datatable store value in to datatable and process it

DataTable dt = new DataTable();
    dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)),
                        new DataColumn("PageName", typeof(string)),
                        new DataColumn("PageUrl",typeof(string)) });
    dt.Rows.Add(1, "Page1", "Page1.aspx");
dt.Rows.Add(2, "Page2", "Page2.aspx");
dt.Rows.Add(3, "Page3", "Page3.aspx");
dt.Rows.Add(4, "Page4", "Page4.aspx");


try this :

string filename = "Formame.aspx";
string name = Request.PhysicalApplicationPath +"Foldername\\"+ filename;
bool status = System.IO.File.Exists(name);
if(status==true)
{
//your COde
}
else 
{
//your code
}


这篇关于如何在不使用数据库的情况下从asp.net网站上搜索网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆