• Using jQuery DataTables to realize data paging display function in asp.net MVC


    1. The method code in the controller is as follows: Since the stored procedure in the method does not have paging parameters, there is still room for further optimization. /// <summary> ///Get the list of measuring points /// </summary> /// <returns></returns> [HttpPost] public JsonResult GetMeasurePointList(string TreeID, string TreeType, int sEcho, int iDisplayStart, int iDisplayLength) { […]

  • Asp.net method of exporting excel general class using npoi


    To solve the problem of Excel garbled code in saving Chinese file names, mainly judge Firefox or IE browser, and then make corresponding judgment. The core code is as follows: System.Web.HttpContext.Current.Response.ContentType = “application/vnd.ms-excel”; //Set the name of the downloaded excel file\ if (System.Web.HttpContext.Current.Request.ServerVariables[“http_user_agent”].ToString().IndexOf(“Firefox”) != -1) { //Firefox browser System.Web.HttpContext.Current.Response.AddHeader(“Content-Disposition”, string.Format(“attachment;filename={0}”, “=?UTF-8?B?” + Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(fileName)) + “?=”)); […]

  • Asp.net MVC rewrites razorview engine to realize multi topic switching


    There are two ways to switch topics in asp.net MVC, one is to switch CSS and JS references of skin, the other is to rewrite view engine. The way of rewriting the view engine is more flexible, because I can not only make the layout and style different under different themes, but also make the […]

  • Solution of session invalidation caused by folder or file operation in ASP. Net program directory


    1. Configure web.config <system.web> <sessionState mode=”StateServer” stateConnectionString=”tcpip=″ sqlConnectionString=”data source=;Trusted_Connection=yes” cookieless=”false” timeout=”40″/> </system.web> 2. Add asp.net status service code in global.asax void Application_Start(object sender, EventArgs e) { //Code that runs when the application starts try { //Start asp.net state service string g_serviceName = “aspnet_state”; System.ServiceProcess.ServiceController[] serviceControllers = System.ServiceProcess.ServiceController.GetServices(); foreach (System.ServiceProcess.ServiceController service in serviceControllers) { if (service.ServiceName […]

  • Detailed explanation of flexible configuration in asp.net core


    preface Asp.net core supports external files and command-line parameters to configure the configuration information needed by system operation. Let’s talk about the specific usage from the following two common scenarios. 1、 Monitor address and port configuration 1. Command line mode Asp.net core system is started by command line. The commands used are as follows: dotnet […]

  • Use asp.net MVC partial view to render HTML


    In order to improve the user experience, we generally use ajax to load data, and then render HTML according to the data. Rendering HTML can use front-end rendering and server-side rendering. Front end rendering Use the front-end template engine or MVC framework, such as the template of undercore.js or the angular.js framework. Of course, you […]

  • Asp.net core environment variables and boot settings configuration tutorial


    In this part, we will discuss a new function in asp.net core: environment variables and startup settings, which makes debugging and testing easier. We only need to modify the configuration file to switch the development, preview and production environment. ASPNETCORE_ENVIRONMENT The core of asp.net core control environment switching is “aspnet core”_ Environment variable, which directly […]

  • Example of blog calendar function based on calendar in asp.net


    This paper introduces the realization of blog calendar function based on calendar in asp.net. The details are as follows: How to use the calendar control of. Net to achieve the effect of site calendar in blog? We know that the most important function of site calendar is to show the day when the blog owner […]

  • An example of DES encryption and decryption based on asp.net


    This paper gives an example of DES encryption and decryption realized by asp.net. The details are as follows: //Encryption method private string encrypt(string strToEncrypt) { if (strToEncrypt == null || strToEncrypt == “”) return strToEncrypt; DESCryptoServiceProvider des = new DESCryptoServiceProvider(); //Put the string into the byte array and choose the encoding method byte[] inputByteArray = […]

  • Codefirst builds ASP. Net core2.0 website from scratch


    Step by step, I will teach you how to build ASP. Net core2.0 website. All of the following are built in. Net core2.0 environment and have been built Right click Solutions > New Project > Select web > ASP. Net core web application (. Net core) Select web application, do not select to enable docker […]

  • Taghelper: a new feature of asp.net core


    Today, I’ll talk about the new features of asp.net core. Today, I’ll talk about taghelper. Although the most helpful thing to learn about. Net is Microsoft’s official instructions, in which some instructions are written very clearly. However, Microsoft has not yet had time to translate the. Net core into the document, which is hard for […]

  • Advanced usage of tag assistant in asp.net core taghelper + form


    In the last blog, I explained the basic usage of taghelper and the generation of custom tags, so I’ll strike while the iron is hot, and share the advanced usage of taghelper with you ~ ~, you can also leave a message under my blog. For my initial contact with asp.net core, you can see […]