Possible to have ampersands ("&") in URL BEFORE the query string? - url

My client is determined to have a page at /nfm&t so I made a directory named nfm&t with an index.html (to test) and that URL is still throwing a 404. So apparently it's not that easy.
Any ideas? Or is there a way to just redirect nfm&t to nfmt, so that the URL at least resolves?
This is a Windows server, by the way, which throws a wrench into how I'm used to doing redirects.

Turning on AllowRestrictedChars and enabling VersionCompatibility should do it.

Why would a Windows Server throw a wrench into how you do redirects? If you are using IIS 7, you can use URL Rewrite Module. It is built into IIS. If you are using IIS 6, there is ISAPI Rewrite, which is an external module. Both use the same syntax as mod_rewrite for Apache.

Do you have a /nfm directory? If you don't, try making one. Either way, put in a Default.aspx file and have it spit back at you the exact path it's trying to access. Chances are, when you have this here, it will go to example.com/nfm/Default.aspx and let you run something from there.
If you do get to that directory, then try redirection to example.com/nfm%26t and see if it works. If this still doesn't help it, then you're SOL

I tried this on my Snow Leopard ( OSX 10.6.2 ) workstation with Apache and it works. That is from Firefox 3.6. Looks like a Windows thing you are struggling with. Honestly I didn't think that would work without encoding but you never know until you try.
alt text http://www.vertigrated.com/images/so_screenshot.png

Or is there a way to just redirect
nfm&t to nfmt, so that the URL at
least resolves?
Sure. Make a general url handler and/or an error handler. When it encounters a url, if that url is equal to /nfm&t, then under the hood rewrite the context to whatever page you actually really want to return. Is this a good idea? Probably not. But it will work. Keith's answer suggests two ways to grab the url and do stuff, though you could also do this via a global asax file (being careful to execute an aspx page when you hit an error so it actually gets hit) if you're using .Net.

Related

URL Routes In IIS7 MVC 5 (Single Paged Application)

After publishing a MVC5 web application of mine to my IIS server (Individual User Accounts), it would seem that the URL is accessed incorrectly.
During debug, it would be e.g http://localhost:1234/api/Account/UserInfo?=XXXXX
The debug works just fine. The only issue kicks in after I've published it via my IIS7 server.
After publishing and using Google Chrome's console, it would appear that the page is requesting for a resource at mydomainname.com/api/Account/UserInfo?=XXXX instead of mydomainname.com/WEBAPPLICATIONNAME/api/Account/UserInfo?=XXXX.
My best guess is to modify the URLs in /Scripts/app/app.datamodel.js but it would just cause more parsing problems.
I've searched around and can't seem to find any related problems. I hope someone here will be able to lend a hand.
Look like you are using relative path like "/api/Account/UserInfo". Instead i'll recommend you to use #Url.Content("/api/Account/UserInfo"). This will solve your problem
Explanation
In local system when we run application in WebDev server it never have sub folder (like WEBAPPLICATIONNAME) therefore you relative path work correctly. but when you host your application in IIS under Default website in another new website /Virtual folder (like 'WEBAPPLICATIONNAME') then "/api/Account/UserInfo" fall back to Default Website because for '/' in starting. #Url.Content or #Url.Action make sure to add virtual directory name, hence changing your path to "/WEBAPPLICATIONNAME/api/Account/UserInfo" in IIS.

AngularJs Routing | don't change URL

I am developing an App that uses the AngularJs Router.
So my URLs look like that:
appName/viewOrders
My problem is, when I refresh the browser with F5 I get an 404 Error. (Because there isn't a folder or even file named viewOrders)
I can't redirect it via a config file because I am not able to use one in the environment where I am developing (An Sharepoint 2013 App).
So I came to this idea:
When I click the navigation, the Url doesn't change and stays at
/appName
But the view does it.
How can I achieve it? Have I to use the ui-router?
If you have restricted access and are unable to use the answer #tommyd456 (which it sounds like that may be the case), another option is to omit the url completely using stateProvider (ui-router).
Angular ui-router: Can you change state without changing URL?
Not sure if you've solved this issue but here's a potential solution anyway...
You're using HTML5 mode so you need server-side rewrite as explained here: https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode
However, it sounds like you've got restricted access to a server so why stop HTML5 mode.
Don't hack at it like you're suggesting - that could get nasty.

ASP.NET MVC server path is different from application path

I have an unusual circumstance where our web server inserts a folder into the url path before loading the page. Let me give you an example:
The app is called equipment and if I were to run it on a normal server setup, it would look like:
www.site.com\equipment\home\index
BUT when I run it on our server, it inserts "idn" in the url:
www.site.com\idn\equipment\home\index
The messes up my relative references. The MVC functions want to redirect to use "\equipment\" instead of "\idn\equipment\". This happens with Scripts.Render(), Return View(), etc.
Also, I can't hardcode the "idn" into my urls b/c then it is no longer relative and it won't work on my dev box or test servers b/c they don't have a "idn" subfolder in localhost.
I also tried functions such as Request.ApplicationPath and what not but none of them return the "idn" in the result.
Is there way to MVC to know that this "idn" was inserted into the url and account for it?
Thanks!
Create your application on the test/production server in the idn folder, then it all works.

Why is meta refresh redirect no longer working and how can I fix it?

Thanks in advance for any help you can provide!
I have a website built in Ruby on Rails. My site has a webpage, located at example.com/communityboard, that you can use to enter a separate Community area (an off-the-shelf bulletin board called bbPress.)
I want users who type in the URL example.com/community to be redirected to example.com/communityboard . It used to work this way, but for some reason, the redirect no longer works in any browser but IE.
We accomplished this redirect by placing an index.html file in the /community folder where bbPress had been installed. The entire code for the index.html file reads
<meta http-equiv="refresh" content="0;url=http://example.com/communityboard">
Back when we built the site, I was told that a meta refresh redirect using an index.html file was the best option. The redirect had to address ONLY a single page (http://example.com/community) and not all of the sublevels of the community bb (which lives at http://example.com/community/index.php). Otherwise, the community bb and all of its sublevels would be redirected.
So... my questions:
Why is the meta refresh redirect not working anymore?
How can I fix it?
Thanks again for any help you can offer!
If it's only working in IE, it's possible there's a script or parsing issue that's breaking other browsers. I would run the HTML through a validator like http://validator.w3.org/.
Meta-refresh is a legacy practice that is now discouraged -- the wikipedia entry contains more info and links to alternative solutions: http://en.wikipedia.org/wiki/Meta_refresh.
Here's what happened according to my developer. I don't fully understand the explanation, so I'm not sure I can answer follow-up questions! "With the old mongrel cluster, Apache would recognize "/community" as a directory, silently forward to "/community/", which would then pick up the forwarding index.html file. With Phusion Passenger," which I guess we're using now, "Apache sends the request directly to Passenger if "/community" is not a regular file, and Passenger was returning the 404 error. As a fix, we've disabled passenger in the community folder, which fixes the problem."

IIS 7 and ASP MVC issue with period in query string

I have an issue where I am sending over an email address to be validated against (make sure its not already used and is a valid email address). Now it worked fine on Cassini, but now I am using IIS7 it refuses to map the route.
The Url would look like:
http://localhost:23456/is/email/taken/test%40test.com
I have turned the route debugger on to make sure there is no problem with the route, and if I remove the ".com" bit at the end it works fine and the route matches (although its not a valid email address so is invalid). However if I leave the .com or whatever .extension is used, the route debugger doesnt even display so it makes me think IIS isnt even directing the traffic to ASP and is looking for a static file.
Has anyone else had this before? and if so how do you solve it?
OK, IIS may be treating that as a file with an extension that is blocked or mapped to a handler that is not MVC. It first checks to see if there is a physical file on disk so some of the handling of the URL isn't all MVC engine only. Do you have configurations that are protecting/refusing some extensions?

Resources