Get URL for an image from an MVC solution - c#

I need to add inside my web (REST API) project a folder and an image and send a URL back to the browser that it can be used to load that image. I am using MVC and C#. Any idea?

Related

How to download file into webserver using only angular frontend?

I have a frontend website made using Angular that accepts an uploaded file. I want to be able to save this file into the web server the website is being hosted on. I would prefer to only use Angular to do this, but I can also accept if there is a way to do it in ASP.Net Web API backend.
You can download the webserver file using angular.
Try the below example...
downloadFile() {
window.open("http://www.africau.edu/images/default/sample.pdf") //your URL
}

Send data from web API controller into separate asp.net mvc website

I have the following situation:
There are two different projects in our solution:
asp.net mvc website
asp.net web api (service for mobile apps).
Users should have an ability to upload profile pictures from their mobile apps using mobile web api project. But the problem is that images are physically stored on different server at asp.net mvc website.
So here is the flow:
User uploads picture and sends it to mobileapidomain/api/user/uploadpicture. (base64)
Now I have to send this image to asp.net mvc site and store it on asp.net mvc server.
What is the best way to send current base64 string with image from web api controller into asp.net mvc project?
In such situation I think the best option would be to install within your mvc web application project packages for WebApi and make this project web application (normal usage) and web service at the same time. Then create new ApiController like this:
[HttpPost]
public IHttpActionResult UploadPicture(string base64)
{
// Do something with image
return Ok();
}
If you do not wish to install WebApi libraries there then I would suggest adding new regular Controller for uploading pictures and adding there similar action:
[HttpPost]
public void UploadPicture(string base64)
{
// Do something with image
}
If something goes wrong within the acton throw exception to inform peer that something wrong is going on. If the file is too long to send in one post I would suggest splitting it and concatenating within mvc application as it receives new portions of it.

open webpage in silverlight web application

I'm working on the silverlight web application. i need to implement the google map so i prepare the one webpage in that i write almost code to load the google map and it work fine. now i want to open this page inside the silverlight.
i try to implement the browser control but there is limitation of
browser control that we can't use the browser control in siliverlight
web application.
is there any way to achieve this?
OR
is there any other way to implement the google map into silverlight web application.
You can do this by using telerik RadHtmlPlaceHolder control, that can load .aspx, .html pages.
You just need to create a .aspx file that will load Google Maps using javascript api and call that .aspx file from silverlight telerik RadHtmlPlaceHolder.
Have a look for telerik RadHtmlPlaceHolder control
http://www.telerik.com/products/silverlight/htmlplaceholder.aspx

C#.Net get website folder from web api

I have a website and web api which made on .net platform.
Web api has a ImageUpload(...) method. I get images as base64 encoded string and saving after turning into byte[].
Here is the story:
Web api's root folder located at: domain.com/API and website's: domain.com/httpdocs.
I hold uploaded images in httpdocs/files/images folder. So it's different folder than web api's. Therefore I am not able to save images in httpdocs/files/images folder. Because web api's context's top folder is httpdocs/API. I can't access httpdocs/ folder.
Any idea how to achieve that?
Try using Server.MapPath to get the server side path.

Sharepoint - Integrate c# application

iam new to sharepoint. I have an application created in C#. Now i have to upload to sharepoint portal server and need to create a link in documents tab which will open this application.
If you are simply trying to show the contents of one web page inside of SharePoint then you can use a "Content Editor Web Part". You set the URL of the web part and the web page is displayed inside of an iFrame on your SharePoint page.
If you have an existing C# solution, you could either put that inside a web part or create an application page for it: http://msdn.microsoft.com/en-us/library/ee231581.aspx

Categories