标签云
asm恢复 bbed bootstrap$ dul kcbzib_kcrsds_1 kccpb_sanity_check_2 kcratr_nab_less_than_odr kgegpa MySQL恢复 ORA-00312 ORA-00704 ORA-00742 ORA-01110 ORA-01190 ORA-01200 ORA-01555 ORA-01578 ORA-01595 ORA-600 2662 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 ORACLE恢复 Oracle 恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (106)
- 数据库 (1,801)
- DB2 (22)
- MySQL (79)
- Oracle (1,637)
- Data Guard (53)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (166)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (69)
- Oracle Bug (8)
- Oracle RAC (54)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (611)
- Oracle安装升级 (101)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (86)
- PostgreSQL (33)
- pdu工具 (7)
- PostgreSQL恢复 (11)
- SQL Server (32)
- SQL Server恢复 (13)
- TimesTen (7)
- 达梦数据库 (3)
- 达梦恢复 (1)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (43)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (26)
-
最近发表
- obet(Oracle Block Editor Tool)第二版发布
- Oracle数据块编辑工具( Oracle Block Editor Tool)-obet
- Oracle坏块修复工具:Patch_blk
- ORA-01172 ORA-01151故障处理
- C_OBJ#_INTCOL#坏块导致数据库无法open故障处理
- ORA-600 kkkicreatecgmap:!efn3
- Oracle 19c 202510补丁(RUs+OJVM)-19.29
- 记录一次raid恢复之后数据库故障处理(ora-01200,ORA-26101,ORA-600)
- nbu备份文件img格式直接rman恢复
- ORA-600 kokasgi1故障处理(sys被重命名)
- Patch_SCN for Linux 功能完善
- ORA-600 2662错误处理-202510
- system表空间丢失部分文件恢复
- arm环境vg损坏mysql数据库恢复
- redhat系列7/8进入单用户模式
- Failed to open \EFI\redhat\grubx64.efi – Not Found 故障处理
- 11.2.0.4升级到19c详细操作过程
- Postgres数据库truncate表无有效备份恢复
- 一次幸运的ORA-07445 kdxlin故障恢复
- ORA-704 ORA-604 ORA-1426故障分析处理
分类目录归档:Asp.Net
通过web更新网站(1)
现在维护的网站比较多,经常因为要修改一个小小的东西,要远程登录,或者ftp登录上去下载下来,然后在修改后,再上传上去,总之比较麻烦,我现在总体设想是通过web实现手工的更新网站,既实现通过web下载、上传、删除、编辑。
今天是实现了对整个站点的文件显示,下载和上传到对应目录,为该程序的第一部分
aspx代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function select_dir() {
var select = document.getElementById("selectType");
document.getElementById("h_dir").value = select.options[select.selectedIndex].value; ;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input id="h_dir" type="hidden" runat="server"/>
<asp:Label ID="lbl_dir" runat="server" ></asp:Label>
<asp:Button ID="btn_select" runat="server" Text="查看文件"
onclick="btn_select_Click" />
<div style="width:400px; height:500px; overflow:auto">
<asp:Label ID="show_file" runat="server" ></asp:Label>
</div>
<asp:FileUpload ID="file_up" runat="server" />
<asp:Button ID="btn_up" runat="server" Text="上传文件" onclick="btn_up_Click" />
</form>
</body>
</html>
cs代码
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Threading;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string web_file=Server.MapPath(".");
DirectoryInfo thisOne = new DirectoryInfo(web_file);
lbl_dir.Text="<select id='selectType' onclick='select_dir();' ><option value='" + System.Web.HttpContext.Current.Server.UrlEncode(web_file) + "'>网站目录</option>" + ListSelectShow(thisOne, 0, "") + "</select>";
h_dir.Value = System.Web.HttpContext.Current.Server.UrlEncode(web_file);
if (Request.QueryString["F"]!=null)
{
string d_file = System.Web.HttpContext.Current.Server.UrlDecode(Request.QueryString["F"].ToString());
//求文件名
string[] fs = d_file.Split('\\');
string ext = fs[fs.Length - 1];
//下载文件
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, ext, d_file, 1024000);
if (!success)
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('下载文件失败,请重试');", true);
Page.Response.End();
}
}
}
public string ListTreeShow(DirectoryInfo theDir, int nLevel, string Rn)//递归目录和 文件,树形结构显示
{
if (nLevel == 0)
{
FileInfo[] fileInfo = theDir.GetFiles();
foreach (FileInfo fInfo in fileInfo)
{
Rn += "├";
Rn += "<a href='Default.aspx?F=";
Rn = Rn + System.Web.HttpContext.Current.Server.UrlEncode(fInfo.FullName);
Rn += "'>";
Rn += fInfo.Name.ToString() + "</a> <br />";
}
}
DirectoryInfo[] subDirectories = theDir.GetDirectories();//获得目录
foreach (DirectoryInfo dirinfo in subDirectories)
{
if (nLevel == 0)
{
Rn += "├";
}
else
{
string _s = "";
for (int i = 1; i <= nLevel; i++)
{
_s += "│ ";
}
Rn += _s + "├";
}
Rn += "<b>" + dirinfo.Name.ToString() + "</b><br />";
FileInfo[] fileInfo = dirinfo.GetFiles(); //目录下的文件
foreach (FileInfo fInfo in fileInfo)
{
if (nLevel == 0)
{
Rn += "│ ├";
}
else
{
string _f = "";
for (int i = 1; i <= nLevel; i++)
{
_f += "│ ";
}
Rn += _f + "│ ├";
}
Rn += "<a href='Default.aspx?F=";
Rn = Rn + System.Web.HttpContext.Current.Server.UrlEncode(fInfo.FullName);
Rn += "'>";
Rn += fInfo.Name.ToString() + "</a><br />";
}
Rn = ListTreeShow(dirinfo, nLevel + 1, Rn);
}
return Rn;
}
public static string ListSelectShow(DirectoryInfo theDir, int nLevel, string Rn)//递归目录下拉框显示
{
DirectoryInfo[] subDirectories = theDir.GetDirectories();//获得目录
foreach (DirectoryInfo dirinfo in subDirectories)
{
Rn += "<option value=\"" +System.Web.HttpContext.Current.Server.UrlEncode( dirinfo.FullName) + "\" >";
if (nLevel == 0)
{
Rn += "├";
}
else
{
string _s = "";
for (int i = 1; i <= nLevel; i++)
{
_s += "│ ";
}
Rn += _s + "├";
}
Rn += "" + dirinfo.Name.ToString() + "</option>";
Rn = ListSelectShow(dirinfo, nLevel + 1, Rn);
}
return Rn;
}
protected void btn_select_Click(object sender, EventArgs e)
{
string first_dir = System.Web.HttpContext.Current.Server.UrlDecode(h_dir.Value);
DirectoryInfo thisOne = new DirectoryInfo(first_dir);
show_file.Text = ListTreeShow(thisOne, 0, "");
}
public bool ResponseFile(HttpRequest _Request, HttpResponse _Response, string _fileName, string _fullPath, long _speed)//下载文件
{
try
{
FileStream myFile = new FileStream(_fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
BinaryReader br = new BinaryReader(myFile);
try
{
_Response.AddHeader("Accept-Ranges", "bytes");
_Response.Buffer = false;
long fileLength = myFile.Length;
long startBytes = 0;
double pack = 10240; //10K bytes
//int sleep = 200; //每秒5次 即5*10K bytes每秒
int sleep = (int)Math.Floor(1000 * pack / _speed) + 1;
if (_Request.Headers["Range"] != null)
{
_Response.StatusCode = 206;
string[] range = _Request.Headers["Range"].Split(new char[] { '=', '-' });
startBytes = Convert.ToInt64(range[1]);
}
_Response.AddHeader("Content-Length", (fileLength - startBytes).ToString());
if (startBytes != 0)
{
//Response.AddHeader("Content-Range", string.Format(" bytes {0}-{1}/{2}", startBytes, fileLength-1, fileLength));
}
_Response.AddHeader("Connection", "Keep-Alive");
_Response.ContentType = "application/octet-stream";
_Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(_fileName, System.Text.Encoding.UTF8));
br.BaseStream.Seek(startBytes, SeekOrigin.Begin);
int maxCount = (int)Math.Floor((fileLength - startBytes) / pack) + 1;
for (int i = 0; i < maxCount; i++)
{
if (_Response.IsClientConnected)
{
_Response.BinaryWrite(br.ReadBytes(int.Parse(pack.ToString())));
Thread.Sleep(sleep);
}
else
{
i = maxCount;
}
}
}
catch
{
return false;
}
finally
{
br.Close();
myFile.Close();
}
}
catch
{
return false;
}
return true;
}
protected void btn_up_Click(object sender, EventArgs e)
{
if (file_up.HasFile)
{
try
{
string path = System.Web.HttpContext.Current.Server.UrlDecode(h_dir.Value);
string file = file_up.FileName;
file_up.SaveAs(path + "/" + file);
DirectoryInfo thisOne = new DirectoryInfo(path);
show_file.Text = ListTreeShow(thisOne, 0, "");
}
catch
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('上传文件失败,请重试');", true);
}
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('请选择文件');", true);
}
}
}
发表在 Asp.Net
评论关闭
flash幻灯片
以前一直想写这个这个类此的东西,都苦于没有项目驱动,这次因项目需要,真的搞了一个出来
js代码(导入js文件未给出)
AC_FL_RunContent('type', 'application/x-shockwave-flash', 'data', 'img/advertising.swf?xml=ahsx/flash.ashx', 'width', '300', 'height','200', 'id', 'xifenfei_flash', 'movie', 'img/advertising?xml=ashx/flash.ashx');
c#生成类xml代码
System.Text.StringBuilder str = new System.Text.StringBuilder();
str.Append("<data> <channel>");
str.Append(" <item><link>http://www.baidu.com</link>").Append(" <image>1.jpg</image>").Append(" <title>111111</title></item>");
str.Append(" <item> <link>http://http://www.baidu.com</link>").Append(" <image>2.jpg</image>").Append(" <title>222222</title></item>");
str.Append(" <item> <link>http://www.baidu.com</link>").Append(" <image>3.jpg</image>").Append(" <title>333333</title></item>");
str.Append(" <item> <link>http://www.baidu.com</link>").Append(" <image>1.jpg</image>").Append(" <title>444444</title></item>");
str.Append(" <item> <link>http://www.baidu.com</link>").Append(" <image>2.jpg</image>").Append(" <title>555555</title></item>");
str.Append(" <item> <link>http://www.baidu.com</link>").Append(" <image>3.jpg</image>").Append(" <title>666666</title></item>");
str.Append(" </channel>");
str.Append("</data>");
context.Response.Write(str.ToString());
note:仅供测试,没有和数据库关联起来
发表在 Asp.Net, JavaScript
评论关闭
fckeditor使用说明
在asp.net中使用fckeditor比freetextbox复杂的多,但是这个是完全开源,开源自己控制
配置:web.config中
<appSettings> <add key="FCKeditor:BasePath" value="~/fckeditor/"/> </appSettings>
修改fckcofig.js文件(主要)
var _FileBrowserLanguage = 'aspx' ; var _QuickUploadLanguage = 'aspx';
修改config.asx文件,主要是为了实现不同用户的文件夹放置位置不同
private bool CheckAuthentication()
{
if (Session["vip"] == null ||Session["vip"].ToString() == "")
{
Session["vip"] = "public";
}
return true;
}
UserFilesPath = "../../../../../upload/" + Session["vip"].ToString();
string file_path = folder.Create_folder("../../../../../upload/" + Session["vip"].ToString());
UserFilesAbsolutePath = file_path;TypeConfig[ "Image" ].AllowedExtensions = new string[] { "bmp", "gif", "jpeg", "jpg", "png" };
TypeConfig[ "Image" ].DeniedExtensions = new string[] { };
TypeConfig[ "Image" ].FilesPath = "%UserFilesPath%"+Session["vip"].ToString()+"/";
TypeConfig[ "Image" ].FilesAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%" );
TypeConfig[ "Image" ].QuickUploadPath = "%UserFilesPath%";
TypeConfig[ "Image" ].QuickUploadAbsolutePath = ( UserFilesAbsolutePath == "" ? "" : "%UserFilesAbsolutePath%" );
发表在 Asp.Net, JavaScript
一条评论


加我QQ(107644445)
