js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

js_html_input中autocomplete="off"在chrom中失效的解决办法

分享网上的2种办法:

1-可以在不需要默认填写的input框中设置 autocomplete="new-password"(已实测,有效)

网上咱没有找到对其详细解释,但是发现163邮箱的登录注册是这么用的,

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

 

2-在会自动填充内容在form表单的第一个Input前添加一个隐藏的input  type="password"(待验证):

<input type="password" style="display: none"> <!-- 用于禁止浏览器自动填充的 -->

 

参考网址:

https://blog.csdn.net/xw505501936/article/details/52129579

http://www.cnblogs.com/liughost/p/4531230.html

 

 

 

 

使用JS模拟锚点跳转

A-HTML锚点定义:

设置锚:

<a href="#mao">&nsbp;</a>

设置点:(为了浏览器兼容性,id和name一起设置)

<a id="mao" name="mao">跳至第一个锚点</a>

 

B:使用JS模拟锚点跳转:

js中location.href可以跳转至某个url;

1、window.location.href = window.location.href + "#mao"; 

2、window.location.hash = "#mao"; 

备注:hash只会在跳转到此页面的第一次起作用,再次刷新此页面将不起作用,而href始终起作用

 

 

 

js如何获取url参数

匹配URL参数的正则是:

var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");

JS代码:

var getQueryString = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};












C#模拟httpwebrequest请求_向服务器模拟cookie发送

使用C#代码模拟web请求,是一种常用的方法,以前没专门整理过,这里暂时贴上自己整理的完整代码,以后再做梳理:

 

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...
public class MyRequest
    {
        #region 辅助方法
        public static string HttpGet(string url)
        {
            var request = (HttpWebRequest)WebRequest.Create(url);

            var response = (HttpWebResponse)request.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            return responseString;
        }
        /// <summary>
        /// httpPost请求--参数为object
        /// </summary>
        /// <param name="url">地址</param>
        /// <param name="postObject">Post参数传输为对象</param>
        /// <returns></returns>
        public static string HttpPost(string url, object postObject, string at = "", string rt = "")
        {
            string result = string.Empty;

            try
            {
                var request = (HttpWebRequest)WebRequest.Create(url);
                var postData = JsonConvert.SerializeObject(postObject);

                var data = Encoding.UTF8.GetBytes(postData);  //uft-8支持中文
                request.Method = "POST";
                //request.ContentType = "application/x-www-form-urlencoded";
                request.ContentType = "application/json;charset=UTF-8";
                //request.ContentLength = data.Length;

                //这里使用了coolie容器,用来模拟向服务器发送cookie信息
                CookieContainer zl_Cookie = new CookieContainer();
                zl_Cookie.Add(new Cookie("at", at, "/", ".zhaopin.com"));
                zl_Cookie.Add(new Cookie("rt", rt, "/", ".zhaopin.com"));
                request.CookieContainer = zl_Cookie;
                
                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                result = new StreamReader(response.GetResponseStream()).ReadToEnd();
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            //Console.WriteLine("发送消息结果:" + result);
            return result;
        }
        /// <summary>
        /// httpPost请求--参数为string
        /// </summary>
        /// <param name="url">地址</param>
        /// <param name="postString">post参数参数为字符串</param>
        /// <returns></returns>
        public static string HttpPost(string url, string postString)
        {
            string result = string.Empty;

            try
            {
                var request = (HttpWebRequest)WebRequest.Create(url);

                var data = Encoding.UTF8.GetBytes(postString);  //uft-8支持中文
                request.Method = "POST";
                //request.ContentType = "application/x-www-form-urlencoded";
                request.ContentType = "application/json;charset=UTF-8";
                request.ContentLength = data.Length;

                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                result = new StreamReader(response.GetResponseStream()).ReadToEnd();
            }
            catch (Exception ex)
            {
                result = ex.Message;
                Console.WriteLine("同步签到大屏发送消息error:" + result);
            }

            return result;
        }
        #endregion

    }
js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

 

 

 

 

实习期学到的技术(一)

 

数据清洗

从基础数据表中整理出自己想要的数据,在进行拼接,最后存入事先创建好的表中。

具体方法(1)

定义一个抽象类的方法(基础的操作方法    提供访问)

public abstract class OperationBase
{
protected string _conntionString = ConfigurationManager.ConnectionStrings["SqlServerDBConn"].ConnectionString;
protected string _conntionStringStatistics = ConfigurationManager.ConnectionStrings["SqlServerDBConnStatistics"].ConnectionString;

public delegate void ErrorMessageDelegate(Exception ex);
public delegate void SuccessDelegate();
/// <summary>
/// 错误信息
/// </summary>
public string ErrorMessage { get; protected set; }

/// <summary>
/// 获取错误回调函数
/// </summary>
public abstract event ErrorMessageDelegate ErrorMessageCallBack;
/// <summary>
/// 获取成功回调函数
/// </summary>
public abstract event SuccessDelegate SuccessCallBack;
public abstract bool Main();
protected abstract void DataImport(params object[] data);
}

(2)调用抽象类OperationBase

public class GetRoadNetworkAnalysisOP : OperationBase
{

public override event ErrorMessageDelegate ErrorMessageCallBack;
public override event SuccessDelegate SuccessCallBack;

 

//程序出入口

public override bool Main()
{

//  throw new NotImplementedException();

}

//数据的导入(删除原来的数据在添加新的数据)

protected override void DataImport(params object[] data)
{

//  throw new NotImplementedException();
}

//自己写一个返回list<> (从基础数据中得到想要的数据)

 private List<RoadNetworkAnalysisBase> RoadNetworkAnalysis_GetRoadNetworkAnalysis()
{

(定义所需要字段的标的实体)

(在定义接收数据的实体)

数据拼接(可以写sql,list<>)

返回数据

}

}

 

(3)

public class GetRoadNetworkAnalysis
{
public delegate List<RoadNetworkAnalysisBase> RoadNetworkAnalysisDataBind();

/// <summary>
/// 获取数据
/// </summary>
public event RoadNetworkAnalysisDataBind RoadNetworkAnalysisInfo;


public List<RoadNetworkAnalysisBase> BasislistRoadNetworkAnalysis { get; private set; }
public List<S_RoadNetworkAnalysis> ResultRoadNetworkAnalysis { get; private set; }

public List<T_Administrative> Administrative { get; private set; }
public List<T_Company> Company { get; private set; }

 

public GetRoadNetworkAnalysis(/*string regoinCode*/)
{
BasislistRoadNetworkAnalysis = new List<RoadNetworkAnalysisBase>();
ResultRoadNetworkAnalysis = new List<S_RoadNetworkAnalysis>();
}

/// <summary>
/// 数据清洗
/// </summary>
public void DataCleaning()
{
if (RoadNetworkAnalysisInfo == null)
{
return;
}
else
{
BasislistRoadNetworkAnalysis = RoadNetworkAnalysisInfo(/*RegoinCode*/);
GetRoadNetworkAnalysisInfo();
}
}

public List<S_RoadNetworkAnalysis> GetRoadNetworkAnalysisInfo()
{

return ResultRoadNetworkAnalysis;

}

}

 

--完

 

 

 

 

 

LinqPad是一个非常方便的C#工具(有免费版和收费版). 今天发现它的变量比较功能真是方便啊。且看3行代码产生如下结果:

说明:图中两个变量的成员属性值分别用红色和绿色背景标注;图很长,只截取了一屏;下文附有C#代码(运行于LinqPad 工具中).

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

3 行代码得出如上图结果:

var americanCulture = new CultureInfo ("en-US");
var britishCulture = new CultureInfo ("zh-CN");

Util.Dif (americanCulture, britishCulture).Dump();

 

 

 

 

 

 

 

 

 

 

 

ASP.NET EF 使用LinqPad 快速学习Linq

 

使用LinqPad这个工具可以很快学习并掌握linq[Language Integrated Query]

linqPad官方下载地址:http://www.linqpad.net/

linqPad4百度云下载(for .NET Framework4.0/4.5):链接:http://pan.baidu.com/s/1gflmRDp  密码:3n3f

linqPad5百度云下载(for .NET Framework 4.6):链接:http://pan.baidu.com/s/1dE5Z0VB  密码:qpgc

LINQPad is not just for LINQ queries, but any C#/F#/VB expression, statement block or program. Put an end to those hundreds of Visual Studio Console projects cluttering your source folder and join the revolution of LINQPad scripters and incremental developers.

Reference your own assemblies and NuGet packages. Prototype your ideas in LINQPad and then paste working code into Visual Studio. Or call your scripts directly from the command-line.

Experience LINQPad’s rich output formatting, optional debugger and autocompletion, and the magic of dynamic development and instant feedback! 

LINQPad 并非 LINQ 查询任何 C# /F #/VB 表达式 语句程序结束这些数百视觉工作室控制台项目塞满文件夹参加革命 LINQPad 脚本编写者增量开发人员

引用自己程序集 NuGet 程序包原型想法 LINQPad然后粘贴工作代码 Visual Studio直接命令行调用脚本

体验 LINQPad 的丰富输出格式 可选调试器自动完成神奇动态发展即时反馈 

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

 

 

 先在数据库创建一个数据库MyFirstEF 和CustomerInfo和OrderInfo两张表

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服... --create SQL

安装完毕linqPad之后,打开软件 --Add Connection-->Build data context automatically(Default(LINQ to SQL))

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

我们在linqPad的query标签里把Language 选择为c# Expression ,把Connection 选择数据MyFirstEF 

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

1:Linq left join(left join 是Left outer join 简写)

在面板中输入Linq,点击运行或者直接按F5【注意CustomerInfo/OrderInfo及字段 都需要按照EF中的格式写(不能按照数据库格式)】

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...
from c in CustomerInfo
join o in OrderInfo
on c.Id equals o.CustomerId
into MyLeftJoin
from tt in MyLeftJoin.DefaultIfEmpty()
select new 
{
    cname=c.CustomerName,
    //这里主要第二个集合有可能为空。需要判断
    //oname=tt==null?"":tt.OrderName
    oname=tt.OrderName
}
js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

对应SQL为:

SELECT [t0].[customerName] AS [cname], [t1].[orderName] AS [oname]
FROM [CustomerInfo] AS [t0]
LEFT OUTER JOIN [OrderInfo] AS [t1] ON ([t0].[id]) = [t1].[customerId]

对应lambda表达式为:

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...
CustomerInfo
   .GroupJoin (
      OrderInfo, 
      c => (Int32?)(c.Id), 
      o => o.CustomerId, 
      (c, MyLeftJoin) => 
         new  
         {
            c = c, 
            MyLeftJoin = MyLeftJoin
         }
   )
   .SelectMany (
      temp0 => temp0.MyLeftJoin.DefaultIfEmpty (), 
      (temp0, tt) => 
         new  
         {
            cname = temp0.c.CustomerName, 
            oname = tt.OrderName
         }
   )
js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

2:Linq right join(right join 是Right outer join 简写)[最后生成SQL还是left join]

 在面板中输入Linq,点击运行或者直接按F5

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...
from o in OrderInfo
join c in CustomerInfo
on o.CustomerId equals c.Id
into MyRightJoin
from tt in MyRightJoin.DefaultIfEmpty()
select new
{
    //这里集合有可能为空。需要判断
       //cname=tt==null?"":tt.CustomerName,
    cname=tt.CustomerName,
    oname=o.OrderName
}
js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

对应SQL为:

SELECT [t1].[customerName] AS [cname], [t0].[orderName] AS [oname]
FROM [OrderInfo] AS [t0]
LEFT OUTER JOIN [CustomerInfo] AS [t1] ON [t0].[customerId] = ([t1].[id])

对应lambda表达式为:

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...
OrderInfo
   .GroupJoin (
      CustomerInfo, 
      o => o.CustomerId, 
      c => (Int32?)(c.Id), 
      (o, MyRightJoin) => 
         new  
         {
            o = o, 
            MyRightJoin = MyRightJoin
         }
   )
   .SelectMany (
      temp0 => temp0.MyRightJoin.DefaultIfEmpty (), 
      (temp0, tt) => 
         new  
         {
            cname = tt.CustomerName, 
            oname = temp0.o.OrderName
         }
   )
js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

3:Linq inner join

在面板中输入Linq,点击运行或者直接按F5

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...
from c in CustomerInfo
join o in OrderInfo
on c.Id equals o.CustomerId
select new
{
    cname=c.CustomerName,
    oname=o.OrderName
}
js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

对应SQL为:

SELECT [t0].[customerName] AS [cname], [t1].[orderName] AS [oname]
FROM [CustomerInfo] AS [t0]
INNER JOIN [OrderInfo] AS [t1] ON ([t0].[id]) = [t1].[customerId]

对应lambda表达式为:

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...
CustomerInfo
   .Join (
      OrderInfo, 
      c => (Int32?)(c.Id), 
      o => o.CustomerId, 
      (c, o) => 
         new  
         {
            cname = c.CustomerName, 
            oname = o.OrderName
         }
   )
js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服...

暂时就到这里,其他的参考官方文档。 

 参考链接:

ASP.NET MVC EF直接更新数据(不需查询):http://www.cnblogs.com/Dr-Hao/p/5255630.html

ASP.NET EF(LINQ/Lambda查询):http://www.cnblogs.com/Dr-Hao/p/5356928.html

code write the life, programe change the world