1<%@ Page language="c#" debug="true"%> 2<html> 3<script runat="server"> 4 void Page_Load (Object sender,EventArgs e) 5 { 6 Context.RewritePath ("rewrite_next.aspx?hola=pepe"); 7 string vpath = HttpRuntime.AppDomainAppVirtualPath; 8 if (vpath.EndsWith ("/")) 9 vpath = vpath.Substring (0, vpath.Length - 1); 10 11 /* This one fails with IIS on /test but works with xsp on '/' 12 if (Request.FilePath != vpath + "/rewrite_next.aspx") 13 throw new Exception ("#01" + " " + vpath + " " + Request.FilePath); 14 */ 15 16 if (Request.QueryString ["hola"] != "pepe") 17 throw new Exception ("#02"); 18 19 20 Context.RewritePath ("rewrite_xxx.aspx"); 21 if (Request.FilePath != vpath + "/rewrite_xxx.aspx") 22 throw new Exception ("#03"); 23 24 // QueryString preserved 25 if (Request.QueryString ["hola"] != "pepe") 26 throw new Exception ("#04"); 27 28 Context.RewritePath ("rewrite_xx1.aspx", null, null); 29 if (Request.FilePath != vpath + "/rewrite_xx1.aspx") 30 throw new Exception ("#05"); 31 32 // QueryString preserved 33 if (Request.QueryString ["hola"] != "pepe") 34 throw new Exception ("#06"); 35 36 Context.RewritePath ("rewrite_xx2.aspx", "", ""); 37 if (Request.FilePath != vpath + "/rewrite_xx2.aspx") 38 throw new Exception ("#07"); 39 40 // QueryString preserved 41 if (Request.QueryString.Count > 0) 42 throw new Exception ("#08"); 43 44 Response.Clear (); 45 Response.Write ("OK"); 46 Response.End (); 47 } 48</script> 49<body> 50The test went OK. 51</body> 52</html> 53 54