Detecting Changes in an ASP.NET Web Site - asp.net

The ASP.NET framework does a very good job of detecting when a file has changed and recompiling that file etc. I would like to be able to hook into that update process. Is this at all possible?
I might want to do this as part of an initiative to try and version web sites developed as Web Site projects, versus Web Applications, where the version is easily found in statically deployed assemblies. If I my be misdirecting my energies as there are already better way if versioning web sites, I'd still appreciate some pointers.

I don't know if you can hook into that logic at all - perhaps you could add your code to Application_OnStart as this method will fire when ASP.NET recycles the AppPool and restarts the website.

Have you tried Web Deployment projects?
Scott Gu has a blog post.

You can use ASP.NET SignalR to do it, It's real-time web for .NET

Have you tried developing a separate module for ASP.NET that keeps track of last change?

This might put you on the right path (might -- I haven't tried this).
http://www.codersource.net/csharp_iis_metabase.html (dead link)

Related

db4o on shared hosting with asp.net MVC

I'm wanting to use DB4o on an asp.net MVC project i'm working on but wondering if anyone
has got this working on shared hosting plan, have contacted discountasp and asked them and they said go to the forum
as they were not sure if they supported it or not or any configuration that would be needed.
but the forum wont let my post on because its all filtered to only show comments they like the look of?
anyone had any joy with this with another host and one that runs asp.net MVC as it should be run?
much appreciated
ta
I'm not familiar with the framework, but it seems that you can just place the DLL in the bin folder and you should be set. I've done tons of projects with MVC and the same method of placing the DLL in the bin folder and worked without issues. The host I use is ReliableSite...they're cheap and don't charge $10/mo for a SQL Server database like DiscountASP does.

Manage ASP.NET Web Service Source Code

I'm working on building a set of ASP.NET (2.0) web-services to be deployed into a single web application under IIS7. The services will be added incrementally (over a period of a year or more) by multiple programmers. How should I organize my source in VS2005.
Should I use one project or several?
Should I use a Web-Application or Web-Site project.
How do I manage the web.config that they will all share.
Thanks for your advice.
Do you use source control now? All of your "control" problems are solved by any decent source control system (i.e., not VSS).
I'd put them into a single project assuming they have code and types in common between them. For instance, if they use the same data access layer and underlying database.
I would never use web site "projects" for web services. Any of their advantages are advantages for web sites made up of web pages, and not for the more complex requirements of web services.
I'll speak to how our shop handles this, which I find to work well.
We use several projects. One for each web service. This allows us to publish one service without effecting the others. We're also on VSS (bleck!) which makes for less conflicts.
We use a Web-Site project and it works fine
We manage the web.config by doing a diff on the file before we publish. The web.config's are something that rarely change

Why is global.asax missing from a Website Project

A couple of questions regarding the role of global.asax:
Why is it not included in the Website Project in Visual Studio? Are there other ways of achieving the same functionality without this file?
If I would create a Web Application project, as far as I remember, a global.asax file would be created. If I were to delete it, would the project run?
I tried to look for some explanation regarding the global.asax compilation but didn't find any info about this.. would appreciate help/links. :)
Thanks!
An ASP.NET site can run without the global.asax file. Here is a question which talks about alternatives of global.asax file.
Even if you delete a global.asax file your site will work.
Globax.asax is not required by ASP.NET for a website to run. It is, however, very useful for application-level functionality (like unhandled exception logging).
You can add Global.asax to the website project and it will work fine.
Global.asax is not added by default for web applications. If you have it, you can delete it without problems.
Be careful to include the .compiled files when deploying the website or else the events in Global.asax will not fire.
It sounds like you are familiar with Web Application Projects, now see a Web Site "project" and wonder what's going on. In any case, I'll answer as though that were true. ;-)
In Visual Studio 2005, Microsoft introduced Web Site "projects", which are not projects - they're just directory structures on a local disk, FTP site, etc. They do many things differently from Web Application Projects, and can therefore be confusing (especially if you're like me, trying to answer people's questions, not knowing which they are using).
With Visual Studio 2005 SP1, they restored Web Application Projects. If that's what you're more familiar with, then I suggest you use them. They're real projects, just like they always were.
And, BTW, there will be a global.asax, just like there used to be...

Debug .asp pages with visual studio 2005

I'm migrating a website made in classic asp to asp.net, but the asp.net dev server doesn't handle .asp pages.
Is it possible to make it run .asp pages? Maybe a custom httphandler for .asp?
thanks!
Are you running Winxp with IIS installed? If so, here's what I do: hit the asp pages in the browser using your local IIS, and then open the folder where the ASP pages reside as a website project in VS. Go to the Debug menu, choose Attach to Process, and then look for the dllhost.exe process that is running under the IWAM_MACHINENAME user. You also have to make sure the you have setup the virtual directory to allow ASP server-side debugging. After attaching to that process, you can set breakpoints, etc. as usual.
The last time I had to debug asp pages I found it was easier to insert a bunch of Response.Write()'s. If you cant find a way to do it in VS, then this may help.
Unfortunately you will have to use traditional (or arcane!) methods to debug your asp pages in VS2005 (i.e. alert(), response.write() etc.)
Possibly not what you want to hear, but vs2005 doesn't support this. It was re-added into vs2008. Perhaps one of the free vs2008 express edtions might get you out of this hole?
In addition to the answer provided by patmortech I would recommend that if you are testing a mixed tech site you attach to aspnet_wp to debug the .NET portions of the app. This is also true if your app uses third-party ISAPI filters.
The Cassini server is good for pure .NET only.

Can "classic" ASP.NET pages and Microsoft MVC coexist in the same web application?

I'm thinking about trying out MVC later today for a new app we're starting up, but I'm curious if it's an all or nothing thing or if I can still party like it's 2006 with viewstate and other crutches at the same time...
Yes you can have your webforms pages and MVC views mixed in a single web application project. This could be useful if you have an application that is already built and you want to migrate your app from webforms to mvc.
You need to make sure that none of your webforms pages go in the 'Views' directory in a standard ASP.NET MVC application though. Pages (or views) in the 'Views' directory can't be requested directly through the url.
If you are starting an application from scratch, there would be very little benefit to mixing the two.
Yes. MVC is just a different implementation of the IHttpHandler interface so both classic ASP.NET and ASP.NET MVC pages can coexist in the same app.
As you've probably noticed with the above answers, yes this is very possible to do.
I've actually had to do this on my current project. I was able to get approval to add MVC to our application, but only in the administration section (to limit the risk of affecting current members coming to our site).
The biggest problem I had was converting my Web Site to a Web Application, but once that was done, things were pretty straight forward adding MVC side-by-side our classic code-behind web pages.
The trick for me was to make my MVC pages look as similar as possible to my code-behind pages so the transition looked as seamless as possible.
I am currently working on a new project. While I would like to go down the MVC route all the way, some of the project requirements don't allow me.
One of those requirements is to have a grouping grid from the client-side. Personally have chosen the Telerik Rad-Grid. While they may be in the process of supporting MVC they are not there as yet.
So this means that I have to have a hybrid solution. for the time being until RadGrid fully supports MVC.
While we are in this transition period I think that there will be may more hybrid projects out there until the support of the Third Party Controls catches up.
Regards
Nathan
You'll need to make sure your MVC routes don't conflict with your Web Forms pages so that requests for a .aspx page don't get routed to a controller action as a parameter etc.
See this blog post by Phil Haack for details on how to avoid this.
Yes, it is very much possible for MVC pages to coexist with asp.net web forms. I implemented that in my existing asp.net application for adding new features. We need to make sure of referring the MVC DLLs, registering routing tables for URL routing and configuring the assemblies and namespaces in Web.config file.
If you're mixing MVC with other methodologies you're not really getting the benefit out of it. The point of MVC is to allow you to decrease coupling and increase cohesion, and if only half of your code is doing that, then the other half is inevitably going to restrain your development cycle.
So, I guess while it's possible, I don't think it's worth it. Go all the way or don't go at all.

Resources