asp.net ÇëÇó²ÎÊý´íÎóÒì³£´¦Àí
package com.accp.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
public class MyFilter extends HttpServlet implements Filter {
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest arg0 =(HttpServletRequest)request;
arg0.getSession().setAttribute("eurl", arg0.getRequestURI());
chain.doFilter(request, response);
/***
* ÀàÐèÒª¼Ì³ÐHttpServlet ºÍ ʵÏÖ½Ó¿Ú Filter (¹ýÂËÆ÷)
* Ìí¼ÓÒ»¸ödoFilter ·½·¨£¨ÓÒ»÷Ñ¡Ôñ Source---- Override/mplement Methods£©
* ¶¨ÒåHttpServletRequest,±äÁ¿arg0 ½ÓÊÕ request £¨ÐèҪת»»ÀàÐÍ£©
* arg0.getSession().setAttribute("ErrorUrl", arg0.getRequestURI());
*/
}
public void init(FilterConfig filterConfig) throws ServletException {
// TODO Auto-generated method stub
}
}
------------------Web.XmlµÄÅäÖÃ
<filter>
<filter-name>names</filter-name>
<filter-class>com.accp.filter.MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>names</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<error-page>
<error-code>500</error-code>
<location>/Error.jsp</location>
</error-page>
Ïà¹ØÎĵµ£º
×î½ü×öµÄϵͳÖÐÀϳöÏÖµÄһЩÎÊÌⲻ̫Ã÷°×£¬ÔÚʹÓà Response.End¡¢Response.Redirect »ò Server.Transfer ʱ³öÏÖ ThreadAbortException £¬±¾À´ÏµÍ³ÊÇûÓÐÎÊÌâµÄ£¬ÔÚ±£´æÊý¾ÝʱҲ¿ÉÒÔÕý³££¬±¾À´Ê¹ÓÃtry-catch Óï¾äÊÇÓÃÀ´²¶»ñÒ»Òì³£Çé¿öµÄ£¬µ«ÏµÍ³Õý³££¬Àϲ¶»ñµ½ÏÂÃæµÄ¶«Î÷
##[²Ù×÷¼Ç¼]£º2010-02-23 9:25:12 Sys ......
¹«Ë¾ÒªÇ󿪷¢Ò»¸ö¼Ì³ÐSystem.Windows.Forms.ListViewÀàµÄ×é¼þ£¬ÒªÇó´ïµ½ÒÔϵÄÌØÊ⹦ÄÜ£ºµã»÷ListView¸÷ÁÐÁÐͷʱ£¬Äܰ´ÕÕµã»÷ÁеÄÿÐÐÖµ½øÐÐÖØÅÅÊÓͼÖеÄËùÓÐÐÐ (ÅÅÐòµÄ·½Ê½ÈçDataGridÏàËÆ)¡£¸ù¾ÝÄúµÄ֪ʶ£¬Çë¼òҪ̸һÏÂÄúµÄ˼· £¿
Ö±½Ó·ÅÉÏ´úÂ룺
using System;
using System.Collections.Generic;
using System.Comp ......
1.¾¡Á¿Ê¹ÓÃHtml¾²Ì¬Ò³Ãæ¡£aspxÔÚÊý¾Ý½»»¥·½ÃæÓкܺõĵĽ»»¥ÄÜÁ¦£¬µ«ÊÇÒ²»áÏûºÄÒ»¶¨µÄ·þÎñÆ÷×ÊÔ´£¬ËùÒÔÎÒÃǾ¡Á¿Óô¿htmlµÄҳȥʵÏÖ¡£×îÖØÒªµÄCMSµÄÓ¦ÓÃ
2.±ÜÃâ²»±ØÒªµÄ»ØËͲÙ×÷£¬Ã¿´Îµ¥»÷Ò³Ãæ°´Å¥¶¼Òª¼ÓÔØPage_Loadʼþ£¬ÓÃPage.IsPostBack±ÜÃâ²»±ØÒªµÄ¼ÓÔØ
3.¾¡Á¿ÔÚ¿Í»§¶Ë½øÐÐÑéÖ¤²Ù×÷£¬Í¨¹ýjs½øÐÐʵÏÖ
4.ÓÅÏÈʹÓÃHtml¿ ......
Ò³ÃæÖÐÒýÈ룺
using System.Net;
using System.IO;
ÏÂÃæÁ½¸ö·½·¨£¬½á¹û¶¼ÊÇÒ»Ñù£¬¶¼¿ÉÒÔÏÂÔØÍøÕ¾ÉϵÄͼƬ£»
private void Sava1()
{
string url = "http://192.234.86.15/Maplink//05/000/000/013/000/000/006.png";
WebRequest wreq = WebRequest.Create(url);
HttpWebResp ......
´ò¿ªÒ»¸öÍøÒ³£¬ÉÏÃæÏÔʾ5ÃëÖÓÒÔºóÌø×ªµ½ÆäËûÍøÒ³£¬Ã¿¹ýÒ»Ã룬Ëü¾Í»á¸Ä±ä£¨4ÃëÖÓÒÔºóÌø×ª£¬3ÃëÖÓÒÔºóÌø×ª¡£¡£¡££©
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head&g ......