【图片不存在使用默认图片代替的实例】教程文章相关的互联网学习教程文章

C# 页面抽奖实例 asp.net【代码】

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script src="Scripts/jquery-1.10.2.min.js"></script><title>LuckyDraw</title><style>/*reset css*/body {font-size: 0.8em;letter-spacing: 1px;font-family: "微软雅黑";line-height: 1.8em;}div, h2, p, ul, li {margin: 0;padding: 0;}h1 {font-size: 1em;font-we...

ASP.NET Excel 文件导入与导出实例【代码】

话不多说直接来干货。。。。连接类 Excel 通过 OleDb 类进行操作。 1using System;2using System.Collections.Generic;3using System.Linq;4using System.Web;5using System.Data.OleDb;6 7///<summary> 8/// ExcelHelper 的摘要说明9///</summary>10publicclass ExcelHelper 11{ 12private OleDbConnection conn; 13privatestring connStr = "Provider=Microsoft.Ace.OleDb.12.0;Data Source={0};Extended Properties=‘Excel 12....

asp.net 操作cookie的简单实例

复制代码 代码如下: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie cookie = Request.Cookies["loginInfo"]; if (cookie != null) { cb_repwd.Checked = true; tb_loginName.Text = UIHelper.Decrypt(cookie["loginName"]); tb_pwd.Attributes.Add("value", UIHelper.Decrypt(cookie[...

[ASP.NET Core 3框架揭秘] 依赖注入[8]:服务实例的生命周期【代码】【图】

生命周期决定了IServiceProvider对象采用怎样的方式提供和释放服务实例。虽然不同版本的依赖注入框架针对服务实例的生命周期管理采用了不同的实现,但总的来说原理还是类似的。在我们提供的依赖注入框架Cat中,我们已经模拟了三种生命周期模式的实现原理,接下来我们结合“服务范围”的概念来对这个话题做进一步讲述。一、服务范围(Service Scope)对于依赖注入框架采用的三种生命周期模式(Singleton、Scoped和Transient)来说,...

Asp.net SQL注入实例分享【图】

??Asp.net SQL注入实例分享1.web.config里加链接字段:<configuration><connectionStrings ><add name="myConnectionString"connectionString="Server=10.231.248.177;Database=testdb;User ID=sa;Password=pa$$word;Trusted_Connection=False;"providerName="System.Data.SqlClient"/></connectionStrings>2.拖几个控件在form里:<form id="form1" runat="server"><asp:Label ID="LU" runat="server" Text="User Name:"></asp:Lab...

asp.net 通用的连接数据库实例代码

View Code复制代码 代码如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <center><h2><font face="宋体">访问数据库的通用代码实例</font></h2></center><body> <form id="form1" runat="server"> <div> <font face="宋体"><p align="center">1.请输入相应数据库连接字符串</p><p align="center"><asp:TextBox id="ConnStrTextBox" runat="server" Width="600"><...

asp.net实现简单分页实例

本文实例讲述了asp.net实现简单分页的方法。分享给大家供大家参考。具体实现方法如下:复制代码 代码如下:/// <summary> /// 分页内容 /// </summary> /// <param name="size">页面大小</param> /// <param name="count">页面数量</param> /// <param name="currendIndex">当前页</param> /// <param name="pattern">url模式:demo.aspx?page={0}</param> /// <param name="target">窗口模式</param> /// <returns></returns> publ...

ASP.NET MVC 自我总结的便捷开发实例【代码】

前言工作了这么久了,接触ASP.NET MVC已经很久了,一直都想总结一下它的一些实用的,经常使用的一些技巧,但是因为一直都很懒,也不想总结,所以一直都没有好好写出来,趁着现在有这种冲劲,那么就先把它写好吧.以下都是我对于我来说,觉得比较便捷的代码,当然,我写的东西未必适合所有人,但是至少里面还是有一些比较简单且实用的技巧的.例子主要是参照 http://www.cnblogs.com/duanshuiliu/tag/ASP.NET/ 里面介绍了很多MVC一些很重要而且...

asp.net输出重写压缩页面文件实例

例子  代码如下  using System;  using System.Data;  using System.Configuration;  using System.Web;  using System.Web.Security;  using System.Web.UI;  using System.Web.UI.WebControls;  using System.Web.UI.WebControls.WebParts;  using System.Web.UI.htmlControls;  using System.Text.RegularExpressions;  using System.IO;  /// <summary>  /// PageBase 页面基类  /// </...

asp.net中函数返回参数和调用的实例!(超简单示例)

asp.net中函数返回参数和调用的实例!一、接收 read.aspx.cs调用 string cpuInfo = Read.Pro();二、返回函数,建立一个:read.csusing System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Management; using System.Management.Instrumentation;/// <summary> /// read 的摘要说明 /// </summary> /// public class Read {public Read() { }public static string Pro(){return "ok!...

ASP.NET下向SQLServer2008导入文件实例操作方法

ASP.NET向SQL Server导入文件主要用到FileUpload控件的FileBytes属性。该属性从FileUpload控件所指定的文件返回一个字节数组 。 1.数据库准备为了方便大家能够理解,这里我们只设计两个字段,一个是文件类型字段,字段名为FileType,另一个是存放文件内容字段,字段名为FileContent。创建数据库 ,数据库名为VarFile,语句如下: CREATE DATABASE VARFILE GO 创建表,表名为FileInOut,语句如下: USE VARFILE GO CREATE TABLE FILE...

[ASP.NET Core 3框架揭秘] 依赖注入[8]:服务实例的生命周期【代码】【图】

原文:[ASP.NET Core 3框架揭秘] 依赖注入[8]:服务实例的生命周期生命周期决定了IServiceProvider对象采用怎样的方式提供和释放服务实例。虽然不同版本的依赖注入框架针对服务实例的生命周期管理采用了不同的实现,但总的来说原理还是类似的。在我们提供的依赖注入框架Cat中,我们已经模拟了三种生命周期模式的实现原理,接下来我们结合“服务范围”的概念来对这个话题做进一步讲述。一、服务范围(Service Scope)对于依赖注入框架...

asp.net读取磁盘文件、删除实例代码

复制代码 代码如下: protected void ReadFile() //读取文件夹,文件 { string savePath = @"common"; StringBuilder outstring = new StringBuilder(); string absSavePath = Server.MapPath(savePath); string[] Directorys = Directory.GetDirectories(absSavePath + @"/" + Page.User.Identity.Name); //for (int i = 0; i < Directorys.Length; i++) //{ ...

ASP.NET缓存处理类实例【代码】

本文实例讲述了ASP.NET缓存处理类。分享给大家供大家参考。具体如下: ASP.NET 缓存处理类。用法:Just copy this code into a new class file (.cs) and add it to your ASP .NET website. One thing to keep in mind is that data stored in ASP .NET Cache can be accessible across all sessions. So when creating a cacheID for the object to be stored, it must be unique (or it could be overwritten). I usually store ...

ASP.NET整合Discuz!NT3.5实例说明(含用户登录、评论等)

http://bbs.51aspx.com/showtopic-30029.html#230540前一阵想做一个团购导航网站,看到某些团购导航站都有论坛,自己也想加一个,研究了下Discuz!NT,发现有API接口,就忽然想到了用Discuz!NT来整合网站,岂不是很方便,会员那部分就不需要自己开发了。说干就干,下来API的例子和开发包研究了一下,看了一遍仍然是一头雾水,不知道是不是自己太笨。而且发现API还有错误,来官方论坛求助貌似没有得到回答,看来还是只能靠自己啊。看...