zoukankan      html  css  js  c++  java
  • http put,delete请求


            /// <summary>
            /// PUT 方法只要IIS开启写入就可以上传文件txt/html/gif 等图片(不能asp/aspx/shtm/cer/asa/stm/
            /// 因此当网站提供IIS写入功能可以上传gif等文件然后替换原来的图片达到修改页面的目的
            /// </summary>
            /// <param name="url"></param>
            /// <param name="local"></param>
            /// <returns></returns>
            public static bool UpLoadFile(String url, String local)
            {
                try
                {
                    System.Net.WebClient myWebClient = new System.Net.WebClient();
                    byte[] ret = myWebClient.UploadFile(url, "DELETE", local);
                    String strMessage = Encoding.ASCII.GetString(ret, 0, ret.Length);
                }
                catch (Exception exp)
                {
                    throw exp;
                }
                return true;

            }
            /// <summary>
            /// DELETE 方法只要IIS开启写入就可以删除文件txt/html/gif  等图片(不能asp/aspx/shtm/cer/asa/stm/
            /// </summary>
            /// <param name="url"></param>
            /// <param name="local"></param>
            /// <returns></returns>

            public static bool DeleteFile()
            {
                try
                {
                    System.Net.WebClient myWebClient = new System.Net.WebClient();

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost/1.txt");
                    request.Method = "DELETE";
                    request.ContentType = "application/x-www-form-urlencoded";
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    if (response.StatusCode == HttpStatusCode.OK)
                    {         // some code   
                    }
                }
                catch (Exception exp)
                {
                    throw exp;
                }
                return true;

            }

  • 相关阅读:
    (1)ASCⅡ码与一般乘除与逻辑指令
    (2)串指令的传送
    【转】伟大的代码(97年的Mekka ’97 4K Intro比赛的一等奖作品)汇编机器码
    第四次游戏革命:全息游戏 from:http://www.cnblogs.com/alamiye010/archive/2012/08/15/2640881.html
    sqlce wp
    wp7 blogs
    单例的两种实现方式
    C# event from:http://www.cnblogs.com/leslies2/archive/2012/03/22/2389318.html#a4
    wp7——sqlite数据库操作 from:http://blog.csdn.net/wp_lijin/article/details/7370790
    Linq C#增删改查
  • 原文地址:https://www.cnblogs.com/059212315/p/2295876.html
Copyright © 2011-2022 走看看