html
<a href="<% =strImgUrl%>" >电子期刊</a>
.cs
public string strImgUrl = "";
private void Page_Load(object sender, System.EventArgs e)
{
int MaxNum = Components.Tools.Utils.MaxDirectories();
strImgUrl = "/qikan/"+MaxNum+"/";
}
private void Page_Load(object sender, System.EventArgs e)
{
int MaxNum = Components.Tools.Utils.MaxDirectories();
strImgUrl = "/qikan/"+MaxNum+"/";
}
//by syl_080905 LoadDirectories
public static int MaxDirectories()
{
int maxName = 0;
int name = 0;
//获取path下所有文件夹路径
string path = System.Web.HttpContext.Current.Server.MapPath("~/qikan/");
string[] dire = System.IO.Directory.GetDirectories(path);
foreach(string d in dire)
{
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(d);
try
{
catch(Exception ex)
{
continue;
}
}
return maxName;
}
public static int MaxDirectories()
{
int maxName = 0;
int name = 0;
//获取path下所有文件夹路径
string path = System.Web.HttpContext.Current.Server.MapPath("~/qikan/");
string[] dire = System.IO.Directory.GetDirectories(path);
foreach(string d in dire)
{
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(d);
try
{
name = Convert.ToInt32(di.Name);
if(maxName < name)
{
maxName = name;
}
catch(Exception ex)
{
continue;
}
}
return maxName;
}