This question already has answers here:
How to get Url Hash (#) from server side
(6 answers)
Closed 9 years ago.
How to get the value after # in the following url:
www.google.com/trian/test#dummyvalue
I am using ASP.NET and C#
A web browser won't pass this value back to the server. So in a typical scenario with a user on their computer accessing your website. The "fragment" portion of the url won't be supplied to the server. Therefore, your asp.net code can not access it. If you change your code to put this data in the querystring, then you can access it server side from asp.net.
Related
This question already has answers here:
ASP.NET MVC Website Read File from Disk Problem
(3 answers)
Closed 7 years ago.
I am developing an azure asp.net web api 2 ,and in my api i am trying to read a dataset ,however i couldnt get my dataset.csv path.I connect to ftp server and i found the rout is : ..../site/wwwroot/dataset.csv this ,
I tried this
string path = "/site/wwwroot/dataset.csv";
and also this
string path=Path.Combine(System.Web.HttpRuntime.AppDomainAppPath, "dataset.csv");
however none of them is working i couldnt read the data file , how can i read it ?
Thanks
Try using System.Web.HttpContext.Current.Request.MapPath() instead:
string path=System.Web.HttpContext.Current.Request.MapPath("~\\dataset.csv");
Oh, and a friendly ask: please search StackOverflow before posting questions - this has been asked and answered here
This question already has answers here:
Retrieving anchor link in URL for ASP.NET
(3 answers)
Closed 8 years ago.
I have a url that receive request with parameters set like this from the return URL of the GoogleAuth. :
LoginReturn.aspx#state=/profile&access_token=token&token_type=Bearer&expires_in=3600
Because of '#' (instead of '?'), if I look in Request.QueryString or Request.RawUrl, there is no parameter and I need to get this access_token.
What is the correct way to get those parameters ?
Thanks for your help !
Everything that follows # is only for the browser. It's usually used to navigate to an anchor in a page, or for single page applications.
The correct way is to edit your query from # to ?
This question already has answers here:
Request Web Page in c# spoofing the Host
(9 answers)
Closed 8 years ago.
How can I set a Host header value with WebClient that is different than the one I use in the URL? For example, in
webClient.OpenRead("http://192.168.10.10/");
the host header value would be "192.168.10.10" but I want it to be something different (e.g. "example.org").
The address must have URL format
webClient.OpenRead("http://192.168.10.10");
This question already has answers here:
Is it possible to make an ASP.NET MVC route based on a subdomain?
(10 answers)
Closed 8 years ago.
I'm writing here becouse one question doesn't let me sleep calmly. How it's possible that site www.visualstudio.com when I sign in to free TFS account, create special 'part' of site with url {myprojectname}.visualstudio.com?. Is it achieveable in my project using ASP.NET MVC 4 or 5? How it doesn't affect in current DNS system? or it affect? What should I read to let my site be so deeply customizable?
for example:
user1.mysite.xx
user2.mysite.xx/aaa/4/sda/something_other
The easiest way is to define a wildcard DNS A or CNAME entry like (BIND syntax):
*.myside.xx. IN A x.x.x.x
In Windows you can use the command line dns tool for it: http://support.microsoft.com/default.aspx?scid=kb;en-us;840687
After that regardless what you write as username.myside.xx it will hit your webserver. From your code you can decide what to do, make a redirect to username.myside.com/username or whatever else
This question already has an answer here:
Get URL of Referer page in ASP.NET
(1 answer)
Closed 8 years ago.
I'm using web api.My question is: I have to check from where call is coming in Global.asax(Application_AcquireRequestState) because I have to restrict some calls which are coming from unknown urls for the purpose of web api security.
You can use Request.UserHostAddress to get the IP address from which the call is coming and Request.UrlReferrer to get the URL that linked to the current URL.