Memories of Net development and memories of Net development
Many of the articles in my blog look better, and I just turned them over, so few of you could write something yourself, and seldom share some of your learning experiences with you, today I want to talk about my memories of my Net development!
I. Memories of knowledge
Do you still remember Handlere?
I remember that Handler had such a function when doing image anti-leech protection!
1 public class ImgHandlerTest: IHttpHandler 2 {3 public void ProcessRequest (HttpContext context) 4 {5 Uri url = context. request. urlReferrer; // from which address 6 if (url = null) 7 {8 context. response. end (); 9 10} 11 if (url. host. toString (). contains (".oa.com") 12 {13 context. response. writeFile (context. request. filePath); 14} 15 else16 {17 context. response. end (); 18 19} 20 context. response. end (); 21} 22 public bool IsReusable23 {24 get {return true;} 25} 26}
Do you still remember Module? At that time, we did prohibit access from IP addresses, that is, we could restrict some IP addresses to access our programs.
1 public class IpTestModule:IHttpModule 2 { 3 4 public void Init(HttpApplication context) 5 { 6 context.BeginRequest += context_BeginRequest; 7 } 8 9 void context_BeginRequest(object sender, EventArgs e)10 {11 //string ip = Common.CommonFun.GetIP();12 //if (ip == "127.0.0.1")13 //{14 // HttpApplication app = sender as HttpApplication;15 // app.Context.Response.End();16 //}17 }18 public void Dispose()19 {20 21 }22 }
I don't know if you remember when using the Module. When there is no asp.net mvc, have you used the Module for login verification?
Public class LoginModule: IHttpModule, System. web. sessionState. IRequiresSessionState {public void Dispose () {throw new NotImplementedException ();} public void Init (HttpApplication context) {context. acquireRequestState + = context_AcquireRequestState;} private void context_AcquireRequestState (object sender, EventArgs e) {// HttpApplication app = sender as HttpApplication; // string url = app. context. Request. RawUrl; // if (url. Contains (". aspx ")&&! Url. Contains ("login. aspx") | (url. Contains ("ashx ")&&! Url. contains ("CreateImageCode. ashx ") // {// if (app. context. session ["LoginUser"] = null) // {// app. context. response. redirect ("~ /Login. aspx "); // app. Response. End (); //} // another method of course
At that time, you used EasyUI. Do you remember what is easy to forget or get stuck in EasyUI?
// Take a good look at the easy ui document // Id ID. Have you ever entered the trap? // Do You Want To verify the client form of easy ui? // Do you know the ID of the selected row in the datagrid list? // The instructor said that you deleted dele: function () {var rows = $ ("# datalist "). datagrid ("getSelections"); if (rows. length <= 0) {$. messager. alert ("prompt", "unselected row", "info"); return ;}// Save the selected row to an array and convert it into a string using commas, var ids = []; for (var I = 0; I <rows. length; I ++) {ids. push (rows [I]. ID);} var idsStr = ids. join (","); // use jquery to interact with the server ajax $. ajax ({url :'.. /.. /ashx/DepartmentHandler. ashx', dataType: "text", data: {ids: IdsStr, action: "delete"}, type: "POST", beforeSend: function () {// disable the button to prevent repeated submission $. messager. progress ({title: "in progress", text: ""}) ;}, success: function (data) {$ ("# datalist "). datagrid ("load", {action: "search"}); $. messager. alert ("successful", data, "info") ;}, complete: function () {$. messager. progress ("close") ;}, error: function () {$. messager. alert ("warning", "Sorry, system error. Please contact the administrator! ");}});}
When the easyUI form is submitted, do you still remember the form verification?
Save: function () {var parentId =$ ("# dptComTree "). combotree ("getValue"); var bool = $ ("# fm "). form ("validate"); if (bool) {var data; if (obJdpt. opType = "1") {data = {name: $ ("# dptdialog input [name = 'name']"). val (), action: "add", pid: parentId};} else {data = {id: $ ("# dptdialog input [name = 'id']"). val (), name: $ ("# dptdialog input [name = 'name']"). val (), action: "update", pid: parentId };}$. Ajax ({url :'.. /.. /ashx/DepartmentHandler. ashx', dataType: "json", data: data, type: "POST", beforeSend: function () {// disable the button to prevent repeated submission $. messager. progress ({title: "in progress", text: ""}) ;}, success: function (data) {// if (obJdpt. state = "1") {// $ ("# dptdialog input [name = 'name']"). val (data. data. name); // $ ("# dptComTree "). combotree ("setValue", [{id: data. data. pid, text: data. data. pname}]); // $ ("# dp Tdialog input [name = 'id'] "). val (data. data. id); //} $ ("# datalist "). datagrid ("load", {action: "search"}); $ ("dpttree "). tree ("reload"); $. messager. alert ("successful", data. msg, "info") ;}, complete: function () {$. messager. progress ("close"); $ ("# dptdialog "). dialog ("close"); // clear the form value $ ("# fm "). form ("reset") ;}, error: function () {$. messager. alert ("warning", "Sorry, system error. Please contact the administrator! ");}});}}
Here I want to talk about whether to clear the data after adding the data every time.
Complete: function () {$. messager. progress ("close"); $ ("# dptdialog "). dialog ("close"); // clear the form value $ ("# fm "). form ("reset ");}
Do you still remember that your boss asked you to perform form verification?
<Div id = "dptdialog"> <form id = "fm" method = "post">
/* Do you still remember the hidden fields with low teeth in the form? **/<Input name = "id" type = "hidden"/> <div class = "dialog-table"> <table width = "100%" border = "0" cellpadding = "0" cellspacing = "0" class = "tk_table"> <tr> <td> parent department </td> <td class = "white-tr"> <input id = "dptComTree" type = "text"/> </td> </tr> <td> name </td> <td class = "white-tr"> <input name = "name" id = "txtDptName" type = "text" class = "easyui-validatebox" data-options = "required: true "/> </td> </tr> </table> </div> </form> </div>
Do you still remember the tree shard or the load tree?
$("#dptComTree").combotree("setValue", [{ id: obJdpt.pid, text: obJdpt.ptext }]);var parentId = $("#dptComTree").combotree("getValue");$("#txtDptName").focus();
Well, this is the first chapter, mainly some small knowledge points of webform and easyUI. The following articles will involve the knowledge of asp.net MVC and easyUI projects, summary of light-weight projects with BootStrap + HTML + ajax + jq and the pitfalls encountered by caipu e-commerce projects, such as mailbox server pitfalls during email sending, this is what I encountered when I forgot my password at the time, and there was a trap of returning web records. The following articles will recall the content!
I have been learning RN for a long time for the whole site. Keep an eye on my favorite friends!