How to Get WebResources.axd working on IIS on XP Pro

G

Guest

I'm trying to figure out what I need to do to configure IIS 5.1 on XP Pro to
work when referencing WebResources.axd.

For example, I have an aspx script that works fine when run from Visual Web
Developer 2005 (Express Edition) built-in web server, but fails when run
under IIS (same file, same location).

I think I've tracked the problem to a failure of IIS to find
WebResources.axd. For example, if I point IE to the src centerated by the
Visual Web Developer server:

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

it returns the proper javascript code.

However, I point IE to the source generated by IIS:

localhost/WebResource.axd?d=-n9cHn2it-BTUPcvYkgh0g2&t=632744679945312500

I get a file not found error.

What do I need to do to configure IIS to properly work with WebResources.axd?

Any suggestions would be greatly appreciated.

Some comments on installation:

ASP.Net 2.0 was installed on XP via Windows Update

I checked web.config and it has the following line (I'm changing angle
brackets to square brackets for this post to prevent display problems):

[add path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" /]

In IIS under application configuration mappings, there was no entry for .axd
I tried adding the following to see if it would help, but it didn't (I got
the same file not found problem I had when this entry wasn't there):

.axd c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
Limit to: GET,HEAD,POST,TRACE
Script Engine; Check if file exists

One work-around I've managed is to point my Visual Web Developer server to

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

get the javascript code, save it as a physical file WebResource.axd so that
when my .aspx script runs on IIS it's code will access the physical file and
run correctly, however, I know this is not a "good" way to make things work :)

Any suggestions as to how I can get my IIS configured properly so that it
returns the WebResource.axd file would be greatly appreciated.

Thanks.
 
J

Juan T. Llibre

re:
What do I need to do to configure IIS to properly work with WebResources.axd?

You don't need to do anything, unless you have very specific needs.

WebResource.axd will be populated automatically
with whatever script resources your objects need.

WebForms.js is an embedded resource inside System.Web.dll,
and it is served using the new WebResource.axd handler.

WebResource.axd is a built-in HTTP handler in ASP.NET 2.0
that's used to retrieve script code into pages.

It doesn't need to be used directly, although it can be.

This handler guarantees that all the script code necessary to perform
the callback is correctly referenced within the page or control.

In particular, WebResource.axd ensures that calls to WebForm_DoCallback
and WebForm_InitCallback are successfully resolved.

If you want to take a look at the real source code behind script callbacks
in ASP.NET 2.0, open the Temporary Internet Files folder on your Web
server machine and look up the file WebResource.axd.

There will be several there.

The code injected through this HTTP handler represents the
callback manager in charge of sending the request and handling the results.

See http://msdn.microsoft.com/msdnmag/issues/04/08/CuttingEdge/
for a code example.

Also, check out Peter Bromberg's article at :
http://www.eggheadcafe.com/articles/20050528.asp

Rick Strahl shows you how to embed your own resources for use with WebResources.axd :
http://west-wind.com/weblog/archive/01302006.aspx






RobertS said:
I'm trying to figure out what I need to do to configure IIS 5.1 on XP Pro to
work when referencing WebResources.axd.

For example, I have an aspx script that works fine when run from Visual Web
Developer 2005 (Express Edition) built-in web server, but fails when run
under IIS (same file, same location).

I think I've tracked the problem to a failure of IIS to find
WebResources.axd. For example, if I point IE to the src centerated by the
Visual Web Developer server:

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

it returns the proper javascript code.

However, I point IE to the source generated by IIS:

localhost/WebResource.axd?d=-n9cHn2it-BTUPcvYkgh0g2&t=632744679945312500

I get a file not found error.

What do I need to do to configure IIS to properly work with WebResources.axd?

Any suggestions would be greatly appreciated.

Some comments on installation:

ASP.Net 2.0 was installed on XP via Windows Update

I checked web.config and it has the following line (I'm changing angle
brackets to square brackets for this post to prevent display problems):

[add path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" /]

In IIS under application configuration mappings, there was no entry for .axd
I tried adding the following to see if it would help, but it didn't (I got
the same file not found problem I had when this entry wasn't there):

.axd c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
Limit to: GET,HEAD,POST,TRACE
Script Engine; Check if file exists

One work-around I've managed is to point my Visual Web Developer server to

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

get the javascript code, save it as a physical file WebResource.axd so that
when my .aspx script runs on IIS it's code will access the physical file and
run correctly, however, I know this is not a "good" way to make things work :)

Any suggestions as to how I can get my IIS configured properly so that it
returns the WebResource.axd file would be greatly appreciated.

Thanks.
 
G

Guest

Many thanks for the response, but let me try to clarify the problem. The
problem I'm trying to solve is that the WesResouce.axd is not being access
automatically when my aspx script is run in IIS (it is in Visual Web
Developer).

You are correct that the code to access WebResources.axd is being properly
generated, I can see this by viewing the source in IE:

When run via IIS:

[script
src="/WebResource.axd?d=-n9cHn2it-BTUPcvYkgh0g2&t=632744679945312500"
type="text/javascript"][/script]

When run via Visual Web Developer built-in server:

[script
src="localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500" type="text/javascript"][/script]

The problem is, when running under IIS, IIS returns a message that
WebResource.axd cannot be found and so no javascript code is returned to IE
and so the page fails to work.

When run under Visual Web Developer built-in serever, WebResource.axd is
found and the javascript is returned so the page works.

Somehow I suspect that IIS is not properly seeing the

[add path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" /]

line in web.config or that System.Web.Handlers.AssemblyResouceLoader is for
some reason not working in IIS since if I take the javascript code that is
returned from WebResource.axd when run under Visual Web Developer built-in
server and save it as a real file called WebResource.axd and then use IIS,
IIS will read the saved WebResource.axd file and work properly. This would
seem to me to indicate that

[add path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" /]

is not working properly in IIS, since IIS appears not to be using
System.Web.Handlers.AssemblyResourceLoader when WebResources.axd is
referenced, but instead is still looking for a real file named
WebResources.axd.

Any suggestions or further clues on how to solve the problem would be
appreciated.

Many Thanks.






Juan T. Llibre said:
re:
What do I need to do to configure IIS to properly work with WebResources.axd?

You don't need to do anything, unless you have very specific needs.

WebResource.axd will be populated automatically
with whatever script resources your objects need.

WebForms.js is an embedded resource inside System.Web.dll,
and it is served using the new WebResource.axd handler.

WebResource.axd is a built-in HTTP handler in ASP.NET 2.0
that's used to retrieve script code into pages.

It doesn't need to be used directly, although it can be.

This handler guarantees that all the script code necessary to perform
the callback is correctly referenced within the page or control.

In particular, WebResource.axd ensures that calls to WebForm_DoCallback
and WebForm_InitCallback are successfully resolved.

If you want to take a look at the real source code behind script callbacks
in ASP.NET 2.0, open the Temporary Internet Files folder on your Web
server machine and look up the file WebResource.axd.

There will be several there.

The code injected through this HTTP handler represents the
callback manager in charge of sending the request and handling the results.

See http://msdn.microsoft.com/msdnmag/issues/04/08/CuttingEdge/
for a code example.

Also, check out Peter Bromberg's article at :
http://www.eggheadcafe.com/articles/20050528.asp

Rick Strahl shows you how to embed your own resources for use with WebResources.axd :
http://west-wind.com/weblog/archive/01302006.aspx






RobertS said:
I'm trying to figure out what I need to do to configure IIS 5.1 on XP Pro to
work when referencing WebResources.axd.

For example, I have an aspx script that works fine when run from Visual Web
Developer 2005 (Express Edition) built-in web server, but fails when run
under IIS (same file, same location).

I think I've tracked the problem to a failure of IIS to find
WebResources.axd. For example, if I point IE to the src centerated by the
Visual Web Developer server:

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

it returns the proper javascript code.

However, I point IE to the source generated by IIS:

localhost/WebResource.axd?d=-n9cHn2it-BTUPcvYkgh0g2&t=632744679945312500

I get a file not found error.

What do I need to do to configure IIS to properly work with WebResources.axd?

Any suggestions would be greatly appreciated.

Some comments on installation:

ASP.Net 2.0 was installed on XP via Windows Update

I checked web.config and it has the following line (I'm changing angle
brackets to square brackets for this post to prevent display problems):

[add path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" /]

In IIS under application configuration mappings, there was no entry for .axd
I tried adding the following to see if it would help, but it didn't (I got
the same file not found problem I had when this entry wasn't there):

.axd c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
Limit to: GET,HEAD,POST,TRACE
Script Engine; Check if file exists

One work-around I've managed is to point my Visual Web Developer server to

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

get the javascript code, save it as a physical file WebResource.axd so that
when my .aspx script runs on IIS it's code will access the physical file and
run correctly, however, I know this is not a "good" way to make things work :)

Any suggestions as to how I can get my IIS configured properly so that it
returns the WebResource.axd file would be greatly appreciated.

Thanks.
 
G

Guest

OK, problem found and solved:

When ASP.Net 2.0 was installed (via Windows Update), it did not put and
entry for the .axd file type in IIS under directory, configuration, mappings.

Actually I had discovered this days ago and put in the entry by duplicating
the entry for .aspx -- that didn't work so I went off on another long
debugging tangent with the web.config file, which eventually led me back to
the IIS entry for .axd -- the critical problem was the "Check that file
exists" box must not be checked (obviously -- once I think about it).

Anyway once the entry:

..axd

c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll

limit to: GET, HEAD, POST, TRACE

Script Engine

was added to the IIS configuration, everything started to work.



RobertS said:
I'm trying to figure out what I need to do to configure IIS 5.1 on XP Pro to
work when referencing WebResources.axd.

For example, I have an aspx script that works fine when run from Visual Web
Developer 2005 (Express Edition) built-in web server, but fails when run
under IIS (same file, same location).

I think I've tracked the problem to a failure of IIS to find
WebResources.axd. For example, if I point IE to the src centerated by the
Visual Web Developer server:

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

it returns the proper javascript code.

However, I point IE to the source generated by IIS:

localhost/WebResource.axd?d=-n9cHn2it-BTUPcvYkgh0g2&t=632744679945312500

I get a file not found error.

What do I need to do to configure IIS to properly work with WebResources.axd?

Any suggestions would be greatly appreciated.

Some comments on installation:

ASP.Net 2.0 was installed on XP via Windows Update

I checked web.config and it has the following line (I'm changing angle
brackets to square brackets for this post to prevent display problems):

[add path="WebResource.axd" verb="GET"
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" /]

In IIS under application configuration mappings, there was no entry for .axd
I tried adding the following to see if it would help, but it didn't (I got
the same file not found problem I had when this entry wasn't there):

.axd c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
Limit to: GET,HEAD,POST,TRACE
Script Engine; Check if file exists

One work-around I've managed is to point my Visual Web Developer server to

localhost:2317/WebResource.axd?d=sbmgIrZc4GkisHONnrRdTA2&t=632744679945312500

get the javascript code, save it as a physical file WebResource.axd so that
when my .aspx script runs on IIS it's code will access the physical file and
run correctly, however, I know this is not a "good" way to make things work :)

Any suggestions as to how I can get my IIS configured properly so that it
returns the WebResource.axd file would be greatly appreciated.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top