Add image to https server using local method in web api c# - c#

I am trying to save image to the URL: “https://www.my domain.com”. But while I am trying to save using file stream I am getting a url path along with project location in my local. For ex: “H:/Api/projectname/https://www.my domain.com“.
Anyone please help me how to deal with this.
Thank you in advance.
I want to save image on “https://www.my domain.com” url. No matter what environment is.

Related

show image from another server HTML

I have this image URL i got from database.
\\Imagepath\ImageFolder\image.png
but i need to put in a img tag in html to show the image in the page, i try to do this way
<img src='\\Imagepath\ImageFolder\image.png'/>
but the page adds the default url for localhost, ie.
http://localhost:1234/\\Imagepath\ImageFolder\image.png
I need your helpfor trying to get the image from that server URL.
I have a lot of images around 6,200 so is not an option to download, i'm show the images in a table.
NOTE: i know the img tag not accept the URL like i have, but maybe you have an idea to do in ASP.NET, i apretiate your help.
NOTE 2:i'm using ASP.NET MVC.
Paths starting with \\ are UNC paths, they are not URLs. In a browser, you have to use a URL to load an image.
The browser is assuming you've tried to specify a relative URL, and is attempting to add the current URL by default in order to fully qualify it and then make a request to it to get the image.
You need to map the path to a virtual directory in your webserver and then point the image's src property at the URL of that virtual directory.
Alternatively, if that's not a workable solution you could write an MVC action method which takes the name of the image file as a parameter and then loads the image from the UNC path in the background and returns the data in a binary response to the browser.

How to get the WebService address dynamically from the txt file in Windows Forms

I'm building a small application and I'm using WebService in it. I was using a local WebService just by adding its reference in my project's solution manager.
My question is: is it possible to get the WebService url address dynamically, for example from a .txt file?
Thanks for every help.
Edit:
I want to change the WebService url address in my app's code. After that, the url will be placed in a .txt file and the app will get it from there.
You can set any url for your WebService client using the clients constructor. There you can provide the url to use:
var client = new YourServiceClient("<bindingName>", new EndpointAddress("<your url>"));
Please check solution here. They are accessing the URL from config file, instead of text while.

File Upload(Image and Video) using Akamai's NetStorage CMS API in C#

I am trying to use the Akamai's NetStorage CMS API for uploading images and videos using asp.net fileupload and looking for any C# REST API(Controller) where we can call NetStorage Upload method.
Looked in their documentation and googled for AKamai CMS API file upload C#, but returned with no luck.
I know how to upload a txt file using Akamai upload method and write content to that text file, but i am looking for something like:
User selects a file
Use that file and upload to Akamai file storage
And when user edits that image(example to rename image title or author info) , get the image from Akamai storage.
Any help would be greatly appreciated.
Thank you so much in advance.
There is a NetStorageKit for C# here:
https://github.com/akamai-open/NetStorageKit-C-Sharp

Nopcommerce long url

I'm using an old nopcommerce 1.90
When i'm trying to access admin panel it generates very long url in all admin pages...
For example: www.mynopcommercestore.com/(F(rdJxygsKRvgH2-aXCIZR0C3pi39UpnKohhHrrbT1ATunvMt4FfV88V0ebEUgb_XXiUkww8KnBeaG66D6wjA82Kl4UsbeUHmBQN2Pp0fn08yISQ6wyjuFhPZFC-5AiXJuTPvTdDEgf7wCucjqc6hPhK_d-GuuNrpSQklM7tjy4kybCjFA4i15IEGfu8tNUWOV9lCqJBEJuE0CXV96XVhHY2n-ykKlQUxLkoVC49txwzls2iMU0))/administration/ProductDetails.aspx?ProductId=563
What is this "strange" string? cookieless? (i have already set it to false)
I'm getting an error when i'm trying to upload an image in ckeditor
(The server didn't reply with a proper XML data. Please check your configuration.)
XML request error: Request-Uri Too Long (I have also set in web.config maxUrlLength="2097151")
But when i remove this "strange" string from url it uploads well.
Could someone help? How to avoid this long url in system?
Kind Regards
You should disable "Cookieless Sessions" in web.config file. Please find more info here

How to get image from url using c# / javascript

I am using file picker apis , i can easily upload my files to there server and they give me a unique url in return . When it comes to again fetch that file its creating a problem to me .
You can tell me how to get back file using that url by using filepicker api .
You can tell me how to use that url and get image , by using c#
When i upload a picture to filepicker.io they return me a json object like following
[{"url":"https://www.filepicker.io/api/file/kIrtNvQRta7GxlFVfiP2","filename":"brazil.jpg","mimetype":"image/jpeg","size":2660,"key":"ZML3OjrFTVyV4waBzRIT_brazil.jpg","isWriteable":true}]
So how to get back that image file using c# / Filepicket javascript api
Edit
In my site user will come and upload many photos , and every link to that photo will be stored in database . Now if user want to see his uploaded pictures then i want to fetch them again from server by url . So give your solutions acc. to this scenario .
Thanks in advance
You could put the picture in a PictureBox first using: PictureBox.Load(string);
After the PictureBox is filled with the image from the url, you can decide what to do next like: saving etc.
PictureBox.Load

Categories