当前位置: 首页 > news >正文

System.IO.FileAttributes

有MM问木马通过网页把空间文件设为只读属性后,是否可以用网页设回去(文件只读用FTP操作不了文件)。我试验是可以的。

< %@ Import  Namespace = " Microsoft.VisualBasic "  % >
< %@ Import  Namespace = " System.IO "  % >
< !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 >
</ head >
< body >
    
< form id = " form1 "  runat = " server " >
    
< div >
    
        
< asp:Button ID = " Button1 "  runat = " server "  onclick = " Button1_Click "  Text = " 设置只读 "   />
& nbsp;
        
< asp:Button ID = " Button2 "  runat = " server "  Text = " 去掉只读 "  onclick = " Button2_Click "   />
    
    
</ div >
    
</ form >
</ body >

< script language = " VB "  runat = server >


    
Public   Sub  FindFile( ByVal   dir   As   String ByVal  boIsReadOnly  As   Boolean ' 参数为指定的目录   
         Dim  Dirpath  As   New  DirectoryInfo( dir )
        
Try
            
Dim  d  As  DirectoryInfo
            
For   Each  d  In  Dirpath.GetDirectories()  ' 查找子目录     
                FindFile(( dir   &  d.ToString()  &   " \ " ), boIsReadOnly)
            
Next  d
            
Dim  f  As  FileInfo
            
Dim  temp  As   String   =   ""
            
For   Each  f  In  Dirpath.GetFiles( " *.* " ' 查找文件   
                temp  =   dir   &  f.ToString()
                
Dim  file1  As   New  System.IO.FileInfo(temp)

                
If  boIsReadOnly  =   True   Then
                    file1.Attributes 
=  System.IO.FileAttributes.ReadOnly
                
Else
                    file1.Attributes 
=  System.IO.FileAttributes.Normal
                
End   If

                
If  file1.Attributes  =  System.IO.FileAttributes.ReadOnly  Then
                    Context.Response.Write(temp 
&   " ---只读<br /> " )
                
ElseIf  file1.Attributes  =  System.IO.FileAttributes.Normal  Then
                    Context.Response.Write(temp 
&   " ---非只读<br /> " )
                
Else
                    Context.Response.Write(temp 
&   " ---未知<br /> " )
                
End   If

            
Next  f
        
Catch  e  As  Exception
            Context.Response.Write(e.Message)
        
End   Try
    
End Sub

    
Protected   Sub  Button1_Click( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)
        FindFile(Server.MapPath(
" ~ " ),  True )
    
End Sub

    
Protected   Sub  Button2_Click( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)
        FindFile(Server.MapPath(
" ~ " ),  False )
    
End Sub
</ script >

</ html >

相关文章:

  • 前端学Markdown
  • 电脑的所有外设接口
  • 暗潮:微信小程序第一弹:虐狗结婚证
  • Linux网卡配置(一)网卡配置文件
  • 使用X Manager远程CentOS 7服务器(XDMCP)
  • 怎么中文版也看不懂哦,茜色的剧本真强大
  • 探讨 ADO.NET DataRow
  • 数据库中的索引
  • 亲历北京Top 500
  • 【翻译】使用IIS 7.0 PowerShell 创建web站点,Web应用,虚拟路径和应用程序池
  • @ModelAttribute使用详解
  • 在园子里吵架属正常
  • Java socket(三)使用TCP传输文件
  • [独库骑行之我们穿过草原]巴音布鲁克大草原
  • angular-ui-bootstrap (1)
  • 9月CHINA-PUB-OPENDAY技术沙龙——IPHONE
  • (ckeditor+ckfinder用法)Jquery,js获取ckeditor值
  • 【vuex入门系列02】mutation接收单个参数和多个参数
  • 【剑指offer】让抽象问题具体化
  • Essential Studio for ASP.NET Web Forms 2017 v2,新增自定义树形网格工具栏
  • Git初体验
  • Linux中的硬链接与软链接
  • Node + FFmpeg 实现Canvas动画导出视频
  • Vue 重置组件到初始状态
  • 阿里云容器服务区块链解决方案全新升级 支持Hyperledger Fabric v1.1
  • 表单中readonly的input等标签,禁止光标进入(focus)的几种方式
  • 纯 javascript 半自动式下滑一定高度,导航栏固定
  • 工程优化暨babel升级小记
  • 区块链技术特点之去中心化特性
  • 微信小程序:实现悬浮返回和分享按钮
  • 我建了一个叫Hello World的项目
  • 一道闭包题引发的思考
  • 阿里云API、SDK和CLI应用实践方案
  • ​【原创】基于SSM的酒店预约管理系统(酒店管理系统毕业设计)
  • ​io --- 处理流的核心工具​
  • ()、[]、{}、(())、[[]]命令替换
  • (1)Android开发优化---------UI优化
  • (6)【Python/机器学习/深度学习】Machine-Learning模型与算法应用—使用Adaboost建模及工作环境下的数据分析整理
  • (C++17) optional的使用
  • (编译到47%失败)to be deleted
  • .Net Redis的秒杀Dome和异步执行
  • .NET 动态调用WebService + WSE + UsernameToken
  • .NET多线程执行函数
  • .NET高级面试指南专题十一【 设计模式介绍,为什么要用设计模式】
  • .net获取当前url各种属性(文件名、参数、域名 等)的方法
  • .NET企业级应用架构设计系列之开场白
  • /var/lib/dpkg/lock 锁定问题
  • ??javascript里的变量问题
  • ??在JSP中,java和JavaScript如何交互?
  • @GlobalLock注解作用与原理解析
  • @Transactional注解下,循环取序列的值,但得到的值都相同的问题
  • [ C++ ] 继承
  • [2018][note]用于超快偏振开关和动态光束分裂的all-optical有源THz超表——
  • [2023年]-hadoop面试真题(一)
  • [AUTOSAR][诊断管理][ECU][$37] 请求退出传输。终止数据传输的(上传/下载)