问题描述
请问高手有没有比以下更好的办法:十分感谢回贴!我原本是用:global.asax里面加入:voidApplication_Start(objectsender,EventArgse){//在应用程序启动时运行的代码RegisterRoutes(RouteTable.Routes);}voidRegisterRoutes(RouteCollectionroutes){routes.MapPageRoute("myid","image/{filename}/{imgtitle}.jpg","~/imageback.aspx");}调用imageback.aspxusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;publicpartialclassimageback:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){stringimgfile=Page.RouteData.Values["filename"].ToString();stringimgpath=@"~/file/sfile/"+imgfile+".jpg";Response.Clear();Response.ContentType="image/png";Response.WriteFile(imgpath);Response.End();}}
解决方案
解决方案二:
不要沉下去呀,有没有帮忙解答一下,十分感谢!
时间: 2024-10-21 19:33:46