ASP.NET Routes

Oct 7, 2010 at 12:52 PM

If I have an ASP.NET module (a la ELMAH) that I want to set up standard routes (so it can have extensionless behavior easily), is this something easily done using NuPack, and if so, are there any examples of such?

Oct 7, 2010 at 7:56 PM

Not sure I quite understand your question.  What are the specific steps you'd have to do by hand to do what you want without NuPack?

NuPack is able to bring in some source files into the app, but cannot edit existing source files.  See the Ninject.MVC3 for an example of package that brings in a source file.  After that, it's just one call to add in global.asax.

Oct 8, 2010 at 12:28 AM
The demos I saw from ScottGu and ScottHa both showed ELMAH, with additions to web.config to add in the handlers/modules.  I'm assuming it didn't just overwrite the existing web.config, so how was this done?  I was assuming there was some kind of manipulation of the existing config file at work, and if so, that therefore manipulation of other files (like global.asax) was a possibility.


On Thu, Oct 7, 2010 at 2:57 PM, davidebb <notifications@codeplex.com> wrote:

From: davidebb

Not sure I quite understand your question.  What are the specific steps you'd have to do by hand to do what you want without NuPack?

NuPack is able to bring in some source files into the app, but cannot edit existing source files.  See the Ninject.MVC3 for an example of package that brings in a source file.  After that, it's just one call to add in global.asax.

Read the full discussion online.

To add a post to this discussion, reply to this email (nupack@discussions.codeplex.com)

To start a new discussion for this project, email nupack@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com




--
Steve Smith | Lake Quincy Media | The Code Project
ssmith@lakequincy.com
http://SteveSmithBlog.com
Oct 8, 2010 at 1:11 AM

Such manipulation is currently limited to XML, which is why it works for config but not for global.asax.

Oct 8, 2010 at 2:31 PM
Ok, thanks.  So I guess that leads me back to my suggestion to the MVC team from lo 3 years ago that routing be configurable outside of code... (if there were an option to add routes in web.config, then I'd be set, right?)

On Thu, Oct 7, 2010 at 8:11 PM, davidebb <notifications@codeplex.com> wrote:

From: davidebb

Such manipulation is currently limited to XML, which is why it works for config but not for global.asax.

Read the full discussion online.

To add a post to this discussion, reply to this email (nupack@discussions.codeplex.com)

To start a new discussion for this project, email nupack@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com




--
Steve Smith | Lake Quincy Media | The Code Project

http://SteveSmithBlog.com
Coordinator
Oct 8, 2010 at 5:23 PM

Yeah, we need to look into this scenario. I have a few ideas, but unfortunately, none are perfect. PreApplicationStartMethodAttribute sort of works for this, but you can only have one per assembly.

Another way that's kind of cheesy is to have your package add an AreaRegistration class. By default, MVC project templates register all areas. Within the area registration method, you could reach back out to RouteTable.Routes and register normal routes, not just area routes.

Cheesy, but could work for many situations. In the meanwhile, we really need this sort of thing core to ASP.NET where we have dynamic discovery of initialization code ala MEF or a DI container.

Oct 8, 2010 at 6:06 PM

Note that this is technically outside the scope of NuPack, and is something that needs solving at the framework level.  My short term solution to this is to simply have the package include a source file with a static method, which you have to call from AppStart (my screencast shows cases of this).  Please note that NuPack is not limited to Web apps, and some packages can makes sense in say a Console app.  For those, the code might be called from Main.