c# - Why dataTokens are in Route? -


 context.maproute("authorized-credit-card", "owners/{ownerkey}/authorizedcreditcard/{action}",  new { controller = "authorizedcreditcard", action = "index" },  new { ownerkey = nameformat }, datatokens: new { scheme = uri.urischemehttps }); 

in route file having above kind of route.

so, 1 tell me meaning of datatokens: new { scheme = uri.urischemehttps ?

and usage of above datatokens inside controller's action method ?

according the documentation:

you use datatokens property retrieve or assign values associated route not used determine whether route matches url pattern. these values passed route handler, can used processing request.

so datatokens kind of additional data can passed route. there 3 datatoken's keys being predefined (the class below comes form source code of asp.net mvc 4 same keys used in version 2):

internal class routedatatokenkeys {     public const string usenamespacefallback = "usenamespacefallback";     public const string namespaces = "namespaces";     public const string area = "area"; } 

i don't think framework uses datatoken named "scheme" difficult answer question. may want search custom application code datatokens["scheme"] , see , why needed.

edit:

i've found an article on "adding https/ssl support asp.net mvc routing". there example of using "scheme" data token. i'm pretty sure application uses in same way.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -