简体   繁体   中英

Can i put URL rewriting http module in a folder?

I am trying to make a generic URL rewrite methods, and i want it portable so i checked this article: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx which is very nice.

But i want to put all my classes, http modules in one folder, then i can just paste this folder in any asp.net website and edit the web.config to point to this http module, thats it, without the need to add anything in the APP_Code as this article teaching.

My question is is that possible? any conc or better ideas?

您始终可以将该代码编译为程序集(.dll),将其放在/ bin文件夹中并更新web.config文件。

The ASP.NET runtime only looks by default in a limited number of folders for code files that it compiles on the fly -- App_Code (and its subfolders) is one of them. If you place code in an arbitrary folder, it won't be found.

The usual approach for what you describe is to build a DLL, and then drop it into the web site's bin folder. You would then have a separate project in Visual Studio for building the DLL. Using a subfolder in App_Code is another possibility.

You could also put your DLL into the GAC, which would make it accessible to all sites on a server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM