asp.net有时候常常用服务器绑定控件有些麻烦...
代码有些杂....
using System;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Web;
using System.Text;
namespace pub.mo
{
public class bind
{
private bind() { }
#region Bind Repeater
public static void repeater(string sql, Repeater dl)
{
using (IDataReader dr = dbhelp.read(sql))
{
repeater(dr, dl);
}
}
/// <summary>
/// 分页绑定
/// </summary>
/// <param name="fd">dd</param>
/// <param name="um"></param>
/// <param name="dl"></param>
/// <returns></returns>
public static fy repeater(fy_date fd, url_manager um, Repeater dl)
{
fy f = new fy(fd, um);
f.suger_page_load();
......
asp.net有时候常常用服务器绑定控件有些麻烦...
代码有些杂....
using System;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Web;
using System.Text;
namespace pub.mo
{
public class bind
{
private bind() { }
#region Bind Repeater
public static void repeater(string sql, Repeater dl)
{
using (IDataReader dr = dbhelp.read(sql))
{
repeater(dr, dl);
}
}
/// <summary>
/// 分页绑定
/// </summary>
/// <param name="fd">dd</param>
/// <param name="um"></param>
/// <param name="dl"></param>
/// <returns></returns>
public static fy repeater(fy_date fd, url_manager um, Repeater dl)
{
fy f = new fy(fd, um);
f.suger_page_load();
......
任何一种使用数据库web程序(当然,也包括桌面程序)都有被SQL注入的风险。防止被SQL注入,最基本的方法是在代码级别就要阻止这种可能,这个网上讲的很多,我就不多说了。不过如果你拿到的是一个已经完工的产品,这个时候该如何解决呢?我介绍几种对于ASP和ASP.NET有效的防止SQL注入的方案,而且是免费的。
UrlScan 3.1
UrlScan 3.1是一个安全方面的工具,微软官方的东西。它会检查所有IIS处理的HTTP请求。UrlScan 可以在有安全问题的HTTP请求到达应用程序之前就阻止这个请求。UrlScan 3.1 是UrlScan 2.5的一个升级版本,支持Windows Vista 和Windows Server 2008系统之上的IIS 5.1, IIS 6.0 和 IIS 7.0。
链接地址:http://www.iis.net/expand/UrlScan 这里还有很多非常有用的IIS扩展,可以看看。
IIS 6 SQL Injection Sanitation ISAPI Wildcard
这个ISAPI dll 也是通过检查HTTP请求避免SQL注入。只兼容windows 2003上的 IIS 6.0。对于Windows XP 上的 IIS 5 不支持。
这是一个开源项目:http://www.codeplex.com/IIS6SQLInjection
转自:http://www.cnblogs.com/DotNetNuke/archive/2009/12/30/1635758.html ......
任何一种使用数据库web程序(当然,也包括桌面程序)都有被SQL注入的风险。防止被SQL注入,最基本的方法是在代码级别就要阻止这种可能,这个网上讲的很多,我就不多说了。不过如果你拿到的是一个已经完工的产品,这个时候该如何解决呢?我介绍几种对于ASP和ASP.NET有效的防止SQL注入的方案,而且是免费的。
UrlScan 3.1
UrlScan 3.1是一个安全方面的工具,微软官方的东西。它会检查所有IIS处理的HTTP请求。UrlScan 可以在有安全问题的HTTP请求到达应用程序之前就阻止这个请求。UrlScan 3.1 是UrlScan 2.5的一个升级版本,支持Windows Vista 和Windows Server 2008系统之上的IIS 5.1, IIS 6.0 和 IIS 7.0。
链接地址:http://www.iis.net/expand/UrlScan 这里还有很多非常有用的IIS扩展,可以看看。
IIS 6 SQL Injection Sanitation ISAPI Wildcard
这个ISAPI dll 也是通过检查HTTP请求避免SQL注入。只兼容windows 2003上的 IIS 6.0。对于Windows XP 上的 IIS 5 不支持。
这是一个开源项目:http://www.codeplex.com/IIS6SQLInjection
转自:http://www.cnblogs.com/DotNetNuke/archive/2009/12/30/1635758.html ......
以.aspx\.asp\.php结尾的页伪静态为以.htm或者.html结尾的页有什么看法,性能会得到提高吗,有什么好处?
那么或者直接生成静态页面又有什么好处,是否推荐在一个网站大量使用呢?
对于腾讯那样的大的门户网站他们的新闻页是生成的静态页呢或者是伪装的?
最佳答案:
运行PHP,ASP.NET,JSP,ColdFusion的网页服务器(如IIS,Apache),大多可以用URL Rewriting来实现隐藏或改变拓展名。大网站,象腾讯,百度(用PHP),都在用URL Rewriting的方法来把拓展名隐藏或改变。好处有几点:
1. 搜索引擎比较喜欢.html,.htm的(与.jsp,.php,.aspx,.cff相比),因为.html, .htm是静态的,更容易让引擎了解你网页的内容。而动态网页的内容是根据用户,来输出不同的内容,不容易让引擎吸收具体HTML内容。
2. 如果不用URL Rewriting将拓展名隐藏或改成.html,那么假如这个网站要换个技术或把动态页面换成静态,则需要寻找所有含有拓展名的连接,把连接所含URL进行拓展名修改(如从JSP换到PHP技术,则要寻找所有含有.jsp的页面,并把所有含.jsp的URL改成.php,费时费力)。URL Rewriting正好避免了这点,因为好的URL是能做到“不变应完变”的。
3. 防止某些黑客恶意攻击。有些大 ......
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Admin_Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="javascript" type ="text/javascript">
function tick()
{
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today, theday;
today = new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
theday = today.getYear()+"年" + [today.getMonth()+1]+"月" +today.getDate() + d[today.getDay()+1];
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "午夜";
} else if (intHours <12) {
hours = intHo ......
在新增数据项的时候,用ajax实现无刷新提交,但上传文件的时候,由于数据类型原因,不能将页面的<asp:FileUpload>中以字符串值的方式传到js里调用。我一共找到了两个方法予以解决,实现无刷新上传。
第一种方法:利用js的ADODB.Stream,将文件先转换成流,再通过js上传到服务器,这样有个好处就是可以上传超大文件,并且由于是数据流,可以支持断点续传、方便显示上传进度等人性化功能。唯一的缺点是要客户端浏览器需要设置安全级别,或者安装相关ActiveX控件(这个控件自己做的,加载到页面中)。
相关代码:
文件有:1个前台页面:upload.html、 1个js控制:upload.js、 1个后台处理页面:Accept.aspx(Accept.aspx.cs)
代码文件如下:
upload.html
复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script src="upload.js" src="upload.js" language="jscript" type="text/jscript"></script>
</head>
<body>
<form id="form1" runat="server">
<div style="width:100%">
<input type="file" id="hid ......
在新增数据项的时候,用ajax实现无刷新提交,但上传文件的时候,由于数据类型原因,不能将页面的<asp:FileUpload>中以字符串值的方式传到js里调用。我一共找到了两个方法予以解决,实现无刷新上传。
第一种方法:利用js的ADODB.Stream,将文件先转换成流,再通过js上传到服务器,这样有个好处就是可以上传超大文件,并且由于是数据流,可以支持断点续传、方便显示上传进度等人性化功能。唯一的缺点是要客户端浏览器需要设置安全级别,或者安装相关ActiveX控件(这个控件自己做的,加载到页面中)。
相关代码:
文件有:1个前台页面:upload.html、 1个js控制:upload.js、 1个后台处理页面:Accept.aspx(Accept.aspx.cs)
代码文件如下:
upload.html
复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script src="upload.js" src="upload.js" language="jscript" type="text/jscript"></script>
</head>
<body>
<form id="form1" runat="server">
<div style="width:100%">
<input type="file" id="hid ......
asp.net的错误--Failed to access IIS metabase 收藏
Server Error in '/sdxx' Application.
--------------------------------------------------------------------------------
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
&nb ......
asp.net的错误--Failed to access IIS metabase 收藏
Server Error in '/sdxx' Application.
--------------------------------------------------------------------------------
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
&nb ......