Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Tue, 1 Jul 2008 04:47:00 -0700,    group: microsoft.public.platformsdk.adsi.iis-admin        back       


.Net 2.0 IIS Application Extension Mapping JS files   
I have created a HttpHandler and added this into the web.config, now at first 
this didn't work as IIS looked like it wasn't forwarding on my request to 
.Net so i added an application extension mapping to the site with the 
following:

Executable: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
Extension: .js
Verbs: All
Script Engine: true
Verify that file exists: false

Once i have added this my handler is then showing the correct output, 
however now all .js files are not being pushed out so the javascript on the 
site is now not there, I have tested this in the global.asax and if i add in 
the following for .js files HttpContext.Response.Write(" "); it then 
completes the request and pushes the files out.

The reason I need to do this is because I need to produce the .js on the fly 
via a db.

What am I missing?

Here are the code snippets:

HTTP HANDLER

using System;
using System.Web;

namespace C4Publisher.HttpHandler
{
	public class ImageUploadHandler: IHttpHandler
	{
		
		#region Implementation of IHttpHandler
		public void ProcessRequest(System.Web.HttpContext context) {
			HttpResponse objResponse = context.Response ;
			objResponse.Write("<html><body><h1>Hello 15Seconds   Reader ") ;
			objResponse.Write("</body></html>") ;
		}

		public bool IsReusable {
			get {
				return true;
			}
		}
		#endregion
	}
}

		<httpHandlers>
			<add verb="*" path="/admin/userupload_image_list.js" 
type="C4Publisher.HttpHandler.ImageUploadHandler" />
		</httpHandlers>
date: Tue, 1 Jul 2008 04:47:00 -0700   author:   Powellze

Re: .Net 2.0 IIS Application Extension Mapping JS files   
Why not use a different extension and just set the content type in your 
response?  That is probably easiest.  You could also map .js files to the 
static file handler and map a more specific extension like *dynamic.js to 
your custom HttpHandler.  It seems like it would be easier to do the former 
though.  Check out how webresource.axd does this in ASP.NET 2.0.

Joe K.

-- 
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Powellze"  wrote in message 
news:313FEAAC-EFD2-484D-8C28-9FC3F79639D2@microsoft.com...
>I have created a HttpHandler and added this into the web.config, now at 
>first
> this didn't work as IIS looked like it wasn't forwarding on my request to
> .Net so i added an application extension mapping to the site with the
> following:
>
> Executable: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
> Extension: .js
> Verbs: All
> Script Engine: true
> Verify that file exists: false
>
> Once i have added this my handler is then showing the correct output,
> however now all .js files are not being pushed out so the javascript on 
> the
> site is now not there, I have tested this in the global.asax and if i add 
> in
> the following for .js files HttpContext.Response.Write(" "); it then
> completes the request and pushes the files out.
>
> The reason I need to do this is because I need to produce the .js on the 
> fly
> via a db.
>
> What am I missing?
>
> Here are the code snippets:
>
> HTTP HANDLER
>
> using System;
> using System.Web;
>
> namespace C4Publisher.HttpHandler
> {
> public class ImageUploadHandler: IHttpHandler
> {
>
> #region Implementation of IHttpHandler
> public void ProcessRequest(System.Web.HttpContext context) {
> HttpResponse objResponse = context.Response ;
> objResponse.Write("<html><body><h1>Hello 15Seconds   Reader ") ;
> objResponse.Write("</body></html>") ;
> }
>
> public bool IsReusable {
> get {
> return true;
> }
> }
> #endregion
> }
> }
>
> <httpHandlers>
> <add verb="*" path="/admin/userupload_image_list.js"
> type="C4Publisher.HttpHandler.ImageUploadHandler" />
> </httpHandlers>
date: Tue, 1 Jul 2008 23:14:44 -0500   author:   Joe Kaplan

Re: .Net 2.0 IIS Application Extension Mapping JS files   
Thanks Joe,

I have used a HttpHandler and caught it in there, I found out one of the 
major issues like you say is down to the AXD, as it appears the JS gets 
forwarded on to this and doesn't complete the request. I have had to manually 
complete the request  for other JS files, otherwise the other JS files were 
sent as empty.

Got to admit I like the use of HttpHandlers :)

"Joe Kaplan" wrote:

> Why not use a different extension and just set the content type in your 
> response?  That is probably easiest.  You could also map .js files to the 
> static file handler and map a more specific extension like *dynamic.js to 
> your custom HttpHandler.  It seems like it would be easier to do the former 
> though.  Check out how webresource.axd does this in ASP.NET 2.0.
> 
> Joe K.
> 
> -- 
> Joe Kaplan-MS MVP Directory Services Programming
> Co-author of "The .NET Developer's Guide to Directory Services Programming"
> http://www.directoryprogramming.net
> --
> "Powellze"  wrote in message 
> news:313FEAAC-EFD2-484D-8C28-9FC3F79639D2@microsoft.com...
> >I have created a HttpHandler and added this into the web.config, now at 
> >first
> > this didn't work as IIS looked like it wasn't forwarding on my request to
> > .Net so i added an application extension mapping to the site with the
> > following:
> >
> > Executable: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
> > Extension: .js
> > Verbs: All
> > Script Engine: true
> > Verify that file exists: false
> >
> > Once i have added this my handler is then showing the correct output,
> > however now all .js files are not being pushed out so the javascript on 
> > the
> > site is now not there, I have tested this in the global.asax and if i add 
> > in
> > the following for .js files HttpContext.Response.Write(" "); it then
> > completes the request and pushes the files out.
> >
> > The reason I need to do this is because I need to produce the .js on the 
> > fly
> > via a db.
> >
> > What am I missing?
> >
> > Here are the code snippets:
> >
> > HTTP HANDLER
> >
> > using System;
> > using System.Web;
> >
> > namespace C4Publisher.HttpHandler
> > {
> > public class ImageUploadHandler: IHttpHandler
> > {
> >
> > #region Implementation of IHttpHandler
> > public void ProcessRequest(System.Web.HttpContext context) {
> > HttpResponse objResponse = context.Response ;
> > objResponse.Write("<html><body><h1>Hello 15Seconds   Reader ") ;
> > objResponse.Write("</body></html>") ;
> > }
> >
> > public bool IsReusable {
> > get {
> > return true;
> > }
> > }
> > #endregion
> > }
> > }
> >
> > <httpHandlers>
> > <add verb="*" path="/admin/userupload_image_list.js"
> > type="C4Publisher.HttpHandler.ImageUploadHandler" />
> > </httpHandlers> 
> 
> 
>
date: Wed, 2 Jul 2008 06:23:00 -0700   author:   Powellze

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us