Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
how to find the querystring value from a Url. Example
http://localhost:233/?country=DE
from this Url how can i get the querystring value. Plaese help me.
Thanks in advance
Sudeer,
Request.QueryString["country"] should do the job..
Mark.
Hi Mark,
Thanks for your reply.
If i have the site like http://localhost:233/en/home.aspx?country=DE then i can get by using the code which you had given.
But My site is running under umbraco.If i ispecify http://localhost:233/?country=DE like this in browser then it is redirecting to http://localhost:233/en/home.aspx with out having querystring.
I dont know weather umbraco internally rewrites the url and redirect to home.aspx with out having querystring.
Thanks
Sudeer
What are you actually trying to do? I'm presuming you are trying to set up a multi lingual site?
Mark,
Yes thats true. I am trying to read the querystring from this Url
Have you had a look at this post about setting up multilingual sites - it seems to be the proper way of doing multilingual sites in Umbraco - it may save you a lot of hassle doing it this way.
you can flow that link
@inject Microsoft.AspNetCore.Http.IHttpContextAccessor HttpContextAccessor
@{ var url = HttpContextAccessor.HttpContext.Request; string currentURL = string.Concat(url.Host, url.Path,"item="); var serviceItemSelected = HttpContextAccessor.HttpContext.Request.Query["item"]; }enter code here
enter code here
access qury string
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting Querystring value in c# from the Url
how to find the querystring value from a Url. Example
http://localhost:233/?country=DE
from this Url how can i get the querystring value. Plaese help me.
Thanks in advance
Sudeer,
Request.QueryString["country"] should do the job..
Mark.
Hi Mark,
Thanks for your reply.
If i have the site like http://localhost:233/en/home.aspx?country=DE then i can get by using the code which you had given.
But My site is running under umbraco.If i ispecify http://localhost:233/?country=DE like this in browser then it is redirecting to http://localhost:233/en/home.aspx with out having querystring.
I dont know weather umbraco internally rewrites the url and redirect to home.aspx with out having querystring.
Thanks
Sudeer
Sudeer,
What are you actually trying to do? I'm presuming you are trying to set up a multi lingual site?
Mark.
Mark,
Yes thats true. I am trying to read the querystring from this Url
http://localhost:233/?country=DE
Sudeer,
Have you had a look at this post about setting up multilingual sites - it seems to be the proper way of doing multilingual sites in Umbraco - it may save you a lot of hassle doing it this way.
Mark.
you can flow that link
@{ var url = HttpContextAccessor.HttpContext.Request; string currentURL = string.Concat(url.Host, url.Path,"item="); var serviceItemSelected = HttpContextAccessor.HttpContext.Request.Query["item"]; }
enter code here
access qury string
is working on a reply...