Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with optional parameters?
Message
De
24/10/2011 16:37:53
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01527224
Message ID:
01527229
Vues:
38
If you take out the optional param, does it reach the method?

>I tried adding it to the tests (manually myself) and yes, it shows the parameter in square brackets.
>
>>Does intellisense show it as optional (surrounded by brackets)?
>>
>>>Hi everybody,
>>>
>>>I've been following PluralSight ASP.NET MVC tutorial along and so far all been good, but somehow the last piece is not working as it supposed to.
>>>
>>>I have this code
>>>
>>>namespace OdeToFood.Controllers
>>>{
>>>    public class CuisineController : Controller
>>>    {
>>>        //
>>>        // GET: /Cuisine/
>>>
>>>        public ActionResult Search(string name = "*")
>>>        {
>>>            name = Server.HtmlEncode(name); 
>>>            return Content("You reached " + name);
>>>        }
>>>
>>>    }
>>>}
>>>
>>>which supposed to allow me to not pass parameter and still work.
>>>
>>>However, when I type just cuisine in the URL, I still get 404 error.
>>>
>>>What may be a problem?
>>>
>>>Thanks in advance.
Very fitting: http://xkcd.com/386/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform