we are not actually rewriting urls, we are securing documents in particular directories using forms authentication. In order for this to work for documents other than aspx files, we needed to add the wildcard application mapping. I tried specifically granting
access the ScriptResource.axd and WebResource.axd files in the web.config per other posts suggestions but nothing has yet worked. I can provide url if it's allowed, or email it...
I'm experiencing the same exact problem. In fact, this problem even occurs when UrlRewriting.Net is disabled. I'm currently running ASP.NET 2.0 on Windows 2000 with IIS 5.0.
When I define the wildcard extension mapping, ScriptService URLs (e.g. xxxxx.asmx/js, xxxxx.asmx/jsdebug, and xxxxx.asmx/MethodName) all fail to work.
However, when I remove the wildcard mapping, everything works again.
One interesting I noticed is the way how IIS handle urls like "xxxxx.asmx/js" under the "no wildcard extension mapping" default IIS configuration.
For a URL like "xxxxx.asmx/js", I had expected it to fail under the default configuration since it should technically treat the URL as an extension-less url. Instead, it seems like IIS progressively traverse the path nodes and check to see if a node in the
path resolves to an actual file. And if it does, it changes the requested path from "/xxxxx.asmx/js" to "/xxxxx.asmx" and stuffs the "/js" part as the "PathInfo" request header. (http://msdn2.microsoft.com/en-us/library/system.web.httprequest.pathinfo.aspx)
It seems like when wildcard extension mapping is turned on, IIS disables that behavior and forwards the request to ASP.net without parsing the requested path.
Buddydvd2. I think I have very similar problem you are experiencing, but littel different. Enabling IIS Wildcard makes Ajax Toolkit Slides control not working. I have posted the problem here, please take a look:
http://forums.asp.net/t/1129701.aspx
I have tried to apply your logic to axd files, but that did not help
Try your solution on a machine with IIS 6 installed. The error you're getting is most likely caused by IIS 5.x. The error response you got, "HTTP verb POST not allowed", says that the request didn't even get routed to ASP.Net's ISAPI extension
module yet.
Also, make sure you select "All verbs" in the extension mapping dialog for your wildcard mapping (i.e "*.").
I wonder maybe there is some way to write some generic code if the file does not exist than rewrite and fix PathInfo this way... But than there is a problem that there are rules in URLrewriter.net for some links without the existent path.
Maybe just setting PathInfo would help, without actual rewriting, so URLRewriter can do it...
This is a reply to the original topic in this thread...
The HttpModule posted 'sort of' works. It takes care of the Path issue for sure, but it still doesnt address another issue. Say you have a url like
http://localhost/articles/157268/
Even though I have my service referenced defined as
<asp:ServiceReference Path="~/ws/PolMach.asmx" />
ASP.NET AJAX isn't rendering the path properly in html. In html it looks like this...
Which is incorrect. It ends up looking to articles/157268/ws/PolMach.asmx. I specified that it should use the file at the root, and it should be written to the page as such. Definately not using a relative path. Chalk this up as another issue overlooked
by the devteam. Hopefully it'll be fixed down the road.
I have yet to find a dynamic and easily adaptable solution to this. I'll keep tinkering. If someone has some way to get ASP.NET to render that script tag as if it were looking to the root of the site I would really appreciate it if you would share :)
Edit: It's a very lame, but seemingly easy hack to fix this (hopefully only until the development team provides an actual fix) . I simply copied the output script tag for the webservice (which the ScriptManager generates), removed the service from
the ScriptManager control in markup and then added the script tag for the service in the same place in html, prepending the '/' character to the src attribute. Seems to work OK, but is by no means a preferred way of making this work.
On a side note, I really wish there was some kind of a progress indicating blog/site which also included release date goals. Would make me feel warm and fuzzy.
buddydvd2
Member
17 Points
15 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jun 09, 2007 12:42 AM|LINK
Are you guys stripping out ".asmx" during the URL rewriting process?
This will not work: http://yoursite.com/ws/WebService/jsdebug
This will work: http://yoursite.com/ws/WebService.asmx/jsdebug
What's the src attribute in your aspx page's script tag?
dunebuggy
Member
160 Points
42 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jun 09, 2007 10:31 PM|LINK
we are not actually rewriting urls, we are securing documents in particular directories using forms authentication. In order for this to work for documents other than aspx files, we needed to add the wildcard application mapping. I tried specifically granting access the ScriptResource.axd and WebResource.axd files in the web.config per other posts suggestions but nothing has yet worked. I can provide url if it's allowed, or email it...
rfurdzik
Contributor
3439 Points
1731 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 05, 2007 03:41 AM|LINK
Buddydvd2. I think I have very similar problem you are experiencing, but littel different. Enabling IIS Wildcard makes Ajax Toolkit Slides control not working. I have posted the problem here, please take a look: http://forums.asp.net/t/1129701.aspx
I have tried to apply your logic to axd files, but that did not help
Please help anybody
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
rfurdzik
Contributor
3439 Points
1731 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 05, 2007 03:49 AM|LINK
This is the source I have on my page for Slides Control in Ajax Toolkit:
<script src="/Ajax/WebResource.axd?d=BP8NIIT9ZyjyxNDvn4jUWQ2&t=633144946505000000" type="text/javascript"></script>
<script src="/Ajax/ScriptResource.axd?d=OjqU9cYdOHT3Lc3mu9VgciBgwPmofPtVg5ti2UT6BGvFCwWflQSi8HHOJb5SHbTBOpqi8xLjNGpMCKeePlMrcNXw15AoxwpCVLq3SBhMer81&t=633144934480000000" type="text/javascript"></script>
Please help
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
buddydvd2
Member
17 Points
15 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 05, 2007 04:00 AM|LINK
Hi Rafal,
Try your solution on a machine with IIS 6 installed. The error you're getting is most likely caused by IIS 5.x. The error response you got, "HTTP verb POST not allowed", says that the request didn't even get routed to ASP.Net's ISAPI extension module yet.
Also, make sure you select "All verbs" in the extension mapping dialog for your wildcard mapping (i.e "*.").
Hope that helps,
Good luck.
-David
rfurdzik
Contributor
3439 Points
1731 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 05, 2007 04:14 AM|LINK
David,
You are absolutly right!!! I just notice I have IIS 5 installed. It works fine if I have wildcard ".*" disabled, but if I have it enabled I am getting
Java Script error:
HTTP verb POST used to access path '/mysite/SlideShow/Slideshow.aspx/getSlides is not allowed
I have tried your solution, but it does not work. I wonder if thsi has something to do with .axd files instead...
I do not have access to IIS 6 now... I will try to upgrade... I am not sure if IIS 6 is available on XP...
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
rfurdzik
Contributor
3439 Points
1731 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 05, 2007 05:37 AM|LINK
I did some more research and debugging. It seesm you are correct. The server variables are not set by IIS, because ASP.NET is in control.
The URL is: http://localhost/Ajax/SlideShow/SlideShow.aspx/GetSlides
PathInfo is empty string
I wonder maybe there is some way to write some generic code if the file does not exist than rewrite and fix PathInfo this way... But than there is a problem that there are rules in URLrewriter.net for some links without the existent path.
Maybe just setting PathInfo would help, without actual rewriting, so URLRewriter can do it...
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
rfurdzik
Contributor
3439 Points
1731 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 05, 2007 06:04 AM|LINK
In fact this was simple, I just copy your solution, but use it with aspx instead... :)
private void OnBeginRequest(object sender, EventArgs e){
HttpApplication app = sender as HttpApplication; HttpContext context = app.Context; string path = context.Request.Path;
int aspx = path.IndexOf(".aspx/", StringComparison.OrdinalIgnoreCase);if (aspx >= 0){
context.RewritePath(
path.Substring(0, aspx + 5),
path.Substring(aspx + 5),
context.Request.QueryString.ToString());
return;}
int asmx = path.IndexOf(".asmx/", StringComparison.OrdinalIgnoreCase);if (asmx >= 0)context.RewritePath(
path.Substring(0, asmx + 5),
path.Substring(asmx + 5),
context.Request.QueryString.ToString());
}
}
Buy Sell Domains - DomainsHeat.com
Free ASP.NET controls: Youtube Web Control and Ajax Zoom Control
buddydvd2
Member
17 Points
15 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 05, 2007 07:36 AM|LINK
Cool. Glad that worked out for you. [:)]
andrew_
Member
104 Points
52 Posts
Re: Wildcard Extensions, RewritePath and /jsdebug
Jul 09, 2007 08:25 PM|LINK
This is a reply to the original topic in this thread...
The HttpModule posted 'sort of' works. It takes care of the Path issue for sure, but it still doesnt address another issue. Say you have a url like http://localhost/articles/157268/
Even though I have my service referenced defined as
<asp:ServiceReference Path="~/ws/PolMach.asmx" />
ASP.NET AJAX isn't rendering the path properly in html. In html it looks like this...
<script src="ws/PolMach.asmx/jsdebug" mce_src="ws/PolMach.asmx/jsdebug" type="text/javascript"></script>
Which is incorrect. It ends up looking to articles/157268/ws/PolMach.asmx. I specified that it should use the file at the root, and it should be written to the page as such. Definately not using a relative path. Chalk this up as another issue overlooked by the devteam. Hopefully it'll be fixed down the road.
I have yet to find a dynamic and easily adaptable solution to this. I'll keep tinkering. If someone has some way to get ASP.NET to render that script tag as if it were looking to the root of the site I would really appreciate it if you would share :)
Edit: It's a very lame, but seemingly easy hack to fix this (hopefully only until the development team provides an actual fix) . I simply copied the output script tag for the webservice (which the ScriptManager generates), removed the service from the ScriptManager control in markup and then added the script tag for the service in the same place in html, prepending the '/' character to the src attribute. Seems to work OK, but is by no means a preferred way of making this work.
On a side note, I really wish there was some kind of a progress indicating blog/site which also included release date goals. Would make me feel warm and fuzzy.