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
Related
This question already has an answer here:
It is possible to read .Rdata file format from C or Fortran?
(1 answer)
Closed 6 years ago.
I have requirement to read data from ".RData" files and process them in C# application. I could not find any API which I can use in C#, I believe there is an API for F# which I don't use as of now because of learning curve in F#.
Could anybody please suggest code or API to read ".Rdata" files?
There's R.NET which would allow you to execute the load function, then get the saved variables from the environment, maybe? My guess is you'll need to run something like
engine.Evaluate("load('/my/data/dir/mydata.RData')");
var data = engine.GetSymbol("myvariablename");
This question already has answers here:
How to get "Host:" header from HttpContext (asp.net)
(4 answers)
Closed 8 years ago.
I want to get datas from an html file on my asp webserver, in Javascript to get actual host we can use the following:
~/mydatas.php
It gives on localhost: "http://localhost/mydatas.php"
I want the same thing but in C# can you help me?
Thanks you.
You could also search in stackoverflow and you will find a lot of answered question which had the same problematic than you. Like this one
Hopes it will help you !
Edit : You can use
HttpContext.Current.Request.Url.AbsoluteUri
It will give you the URL of your web page.
I've already try
HttpContext.Current.Request.Url.Host
which gives on localhost
:\windows\system32\inetsrv\localhost
...
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.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Open/handle Word documents like SharePoint
I´ve developed one website where it is possible to upload docx files to it. Now I want a way to edit it directly in browser, I meant, a way to do like google docs does.
OR
Copy from MSWord to my app window e maintain all the formats, including tables.
for the manipulation of word documents you can use DocX. With this you can read/write from/to word documents (docx not doc). This however is a long way from editing your document in a google docs like manner...
It does match your second request though!
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
multiple upload images on c#/jquery
hey guys!
Yesterday i made here a question about an input type="file" to select multiple files instead of one. And you gave me some solutions like plupload and SWFUpload and some more.
But if possible i want to try something a little bit different, like facebook. The solution that you offered me yesterday have flash, or silverlight, html5, gears or browserplus...
So if you could show me an example like the photo upload of facebook or another i would be very happy!
Regards!
Try: Multiple Upload images with c#/jquery?
Facebook's uploader is a Flash uploader. View the source.