用Javascript隐藏超级链接的真实地址


用Javascript可以隐藏超级链接的真实地址:
在显示下载链接的页sample.aspx的前台合适地方加入以下代码如下:
<ahref="#"onclick="javascript:window.open('DownLoad.aspx?ID=11','newwin','width=350,height=510,scrollbars=0,toolbar=0,resizable=0')">打开窗口</a>

通过DownLoad.aspx文件读取需下载的文件信息,在后台加入代码:
try
{
stringstr="selectFileContent,FileType,FileNamefromfileinfowhereid="+base.Request.QueryString["id"];
SqlDataReaderDr
=pubValue.DataRead(str);

stringstrfilePath="file/"+base.User.Identity.Name;
stringpath="";

if(Dr.Read())
{
strings=Dr["FileName"].ToString();
path
=base.Server.MapPath(strfilePath+"/"+s);

if(File.Exists(path))
{
File.Delete(path);
}


FileStreamstream
=newFileStream(path,FileMode.Create);
stream.Write((
byte[])Dr["FileContent"],0,((byte[])Dr["FileContent"]).Length);
StreamWriterwriter
=newStreamWriter(stream);
writer.WriteLine(
"");
writer.Flush();
writer.Close();
stream.Close();
base.Response.Write("<script>location.href='"+strfilePath+"/"+base.Server.UrlEncode(s).Replace("+","%20")+"';</script>");
}

}

catch(Exceptionexception)
{
base.Response.Write(exception.Message);
}

当鼠标打向打开窗口时,出现的链接信息是#,而不是下载文件的链接地址,从而达到隐藏真实的超级链接地址的效果! 优质内容筛选与推荐>>
1、申请专利的一些事儿
2、linux 操作
3、MySQL入门教程
4、Cocoa设计模式之通知
5、C#中的访问修饰符


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn