易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net 等比例生成上传图片的高质量缩略图的方法

方法1
HttpFileCollection files   = HttpContext.Current.Request.Files;
//我设置的大小不超过A4纸的缩略图
int newWidth=620;
int newHeight=880;
System.Drawing.Image img = null;
            
for(int iFile = 0; iFile < files.Count; iFile++)
{
     ///检查文件扩展名字
     HttpPostedFile postedFile = files[iFile];
     string fileName, fileExtension;
     fileName = System.IO.Path.GetFileName(postedFile.FileName);
     if (fileName != "")
     {
         fileExtension = System.IO.Path.GetExtension(fileName);
         string name=DateTime.Now.ToString("yyyyMMddHHmmssffffff")+iFile+fileExtension;
         string filePath=System.Web.HttpContext.Current.Request.MapPath(@"UpdatePic/") + name;
                        
         if (fileExtension.ToLower()==".jpg" || fileExtension.ToLower()==".gif" || fileExtension.ToLower()==".png")
         {
             //图片大小限制在1K到2M之间
             if(postedFile.ContentLength>=1024 && postedFile.ContentLength<=20480000 && postedFile.ContentType.ToString().ToLower().IndexOf("image") >= 0)
             {
                 img = System.Drawing.Image.fromStream(postedFile.InputStream);
       &nb


相关文档:

ASP.NET页面传值_第四篇_Session

例一:
+++ 修改Global.asax文件:
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{  }
void Application_End(object sender, EventArgs e)
{  }
void Application_Error(object sender, EventArgs e)
{  }
void ......

ASP.NET页面传值_第八篇_WebConfig

+++ 修改WebConfig文件:
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="connStr" value="Data Source=ora11g;uid=scott;pwd=tiger;unicode=true"/>
  </appSettings>
  <connectionStrings>
    <ad ......

微软企业库5.0学习笔记(10)ASP.NET模块依赖注入

    您可以使用HTTP模块,一个到ASP.NET HttpApplicationState类的扩展,在Global.asax编写代码强制ASP.NET在每一个页面请求时自动注入依赖的对象,就像在ASP.NET Web窗体应用程序中讨论的一样.
    下列方法显示了一个合适的方法能够获取PreRequestHandlerExecute事件将它自己注入到ASP.NE ......

探索Asp.net的Postback机制

/* from: http://www.techmango.com/blog/article/DotNet/Explore_Asp_net_postback_mechanism.htm */
__doPostBack作为在asp.net中一个很核心很重要的部分,我们有必要深入了解一下.
其实,__doPostBack是一个很简单的脚本函数.代码如下:
//__doPostBack<input type="hidden" name="__EVENTTARGET" id="__EVENTTA ......

ASP.NET LinkButton控件实现url 地址动态跳转

方法一:<asp:LinkButton runat="server" ID="lbtnClick" PostBackUrl='<%#"~/test.aspx?id="+Eval("id")%>'>zhang</asp:LinkButton>
方法二:<asp:LinkButton runat="server" ID="lbtnClick" PostBackUrl='<%#Eval("id","~/test.aspx?id={0}")%>'>zhang</asp"LinkButton> ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号