ASP.NET, MVC, C# website pass a value though out the application -
ASP.NET, MVC, C# website pass a value though out the application -
this bit of puzzle me.
i need capture uri query string passed home page.
as user travels different pages on web site, have partial view needs uri query string.
i need dynamicly created link in partial view, equals original phone call home page.
example -
if user goes - http://www.mysite.com?mode=joe
, need dynamicly created link equal - http://www.mysite.com?mode=joe
if user goes - http://www.mysite.com?mode=tommy
, need dynamicly created link equal - http://www.mysite.com?mode=tommy
fyi - partial view used in _layout.cshtml
file. phone call within - _layout.cshtml
looks -
@html.partial("mypartial")
thanks!
there number of ways this, simplest save session on home page, , access session variable partial.
you need decide if session expires.
another possible way write cookie on home page request , access request cookie in partial. again, you'd need decide on approach cookies disabled, or wiped out during browsing.
alternatively, @ approach beingness used in link below set language across site. exact implementation differ, concept same:
howto automatically add together specific value current route generated links?
asp.net-mvc
Comments
Post a Comment