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>
Ïà¹ØÎĵµ£º
1.ASP.NETÔËÐÐÔÀí¸ÅÊö
¡¡¡¡ÈçÉÏͼ£¬µ±Ò»¸öhttpÇëÇó·¢Ë͹ýÀ´²¢±»IIS»úÊÕµ½Ö®ºó,IISÊ×ÏÈͨ¹ýÄãÇëÇóµÄÒ³ÃæÀàÐÍΪÆä¼ÓÔØÏàÓ¦µÄdllÎļþ£¬È»ºóÔÚ´¦Àí¹ý³ÌÖн«ÕâÌõÇëÇó·¢Ë͸øÄܹ»´¦ÀíÕâÌõÇëÇóµÄÄ£¿é,¶øÔÚASP.NETÖÐÕâ¸öÄ£¿é¾Í½Ð×öHttpHandler,ΪʲôaspxÕâÑùµÄÎļþ¿ÉÒÔ±»·þÎñÆ÷´¦Àí,ÄÇÊÇÒòΪÔÚ·þÎñÆ÷¶ËÓÐĬÈϵÄHttpHandlerרÃÅ´ ......
×î½ü×öµÄϵͳÖÐÀϳöÏÖµÄһЩÎÊÌⲻ̫Ã÷°×£¬ÔÚʹÓà Response.End¡¢Response.Redirect »ò Server.Transfer ʱ³öÏÖ ThreadAbortException £¬±¾À´ÏµÍ³ÊÇûÓÐÎÊÌâµÄ£¬ÔÚ±£´æÊý¾ÝʱҲ¿ÉÒÔÕý³££¬±¾À´Ê¹ÓÃtry-catch Óï¾äÊÇÓÃÀ´²¶»ñÒ»Òì³£Çé¿öµÄ£¬µ«ÏµÍ³Õý³££¬Àϲ¶»ñµ½ÏÂÃæµÄ¶«Î÷
##[²Ù×÷¼Ç¼]£º2010-02-23 9:25:12 Sys ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Sha ......
ÔÚwindows 2003ÏÂ,ÔÚÔËÐÐwebÓ¦ÓóÌÐòµÄʱºò³öÏÖһϴíÎó:
·þÎñÆ÷ÎÞ·¨´¦ÀíÇëÇ󣬣££¾¶Ô·¾¶“C:\temp\mytest.txt”µÄ·ÃÎʾܾø
˵Ã÷: Ö´Ðе±Ç° Web ÇëÇóÆڼ䣬³öÏÖδ´¦ÀíµÄÒì³£¡£Çë¼ì²é¶ÑÕ»¸ú×ÙÐÅÏ¢£¬ÒÔÁ˽âÓйظôíÎóÒÔ¼°´úÂëÖе¼Ö´íÎóµÄ³ö´¦µÄÏêϸÐÅÏ¢¡£
Òì³ ......
0¡¢ÒýÑÔ
¡¡¡¡Web Ò³ÃæÊÇÎÞ״̬µÄ£¬ ·þÎñÆ÷¶Ôÿһ´ÎÇëÇó¶¼ÈÏΪÀ´×Ô²»Í¬Óû§£¬Òò´Ë£¬±äÁ¿µÄ״̬ÔÚÁ¬Ðø¶ÔͬһҳÃæµÄ¶à´ÎÇëÇóÖ®¼ä»òÔÚÒ³ÃæÌøתʱ²»»á±»±£Áô¡£ÔÚÓÃAsp.NET Éè¼Æ¿ª·¢Ò»¸öWebϵͳʱ£¬ Óöµ½Ò»¸öÖØÒªµÄÎÊÌâÊÇÈçºÎ±£Ö¤Êý¾ÝÔÚÒ³Ãæ¼ä½øÐÐÕýÈ·¡¢°²È«ºÍ¸ßЧµØ´«ËÍ£¬Asp.net ÌṩÁË״̬¹ÜÀíµÈ¶àÖÖ¼¼ÊõÀ´½â¾ö±£´æºÍ´«µÝÊý¾Ý ......