How to upload file directly to MVC4 web application - asp.net-mvc-4

I have this MVC4 web application that does CRUD actions for my database. Now I need to upload log files from native mobile application to database. Since it upload log file directly from mobile application code, it does not use RAZOR web page. I'm not sure how to set controller parameter to accept log file. Please give me some hint!

Related

Is there a way to show file uploading progress bar when uploading a file from a blazor WebAssembly (WASM) to a ASP.NET Core server (blazor hosted)

As the title says, I'm looking for a way to inform users about the file upload progress of a file uploaded from the Blazor WebAssembly (WASM) client to the server project (Api).
P.S. I'm using NET 6.
Thanks.
https://github.com/agency8/BlazorFileUploadApp Had everything I needed, just clone it and you can get on with your work...
Thanks to #MisterMagoo for sharing the link!

Blazor WebAssembly - How can I add a new *.razor page that don't need to recompile or rebuild the project

I am developing a survey project which collects data from the client with Blazor WebAssemly for the Client-side. Each survey form will have a different design and edit-checked rule. So I decide when I create a new survey form, the application will generate a new *.razor page automatically, for example, ClientSurvey.razor page. Everything works well until I navigate the web application to the ClientSurvey.razor I just have created. The system shows error:
404 Not found.
I have to rebuild the project again, and it can show the ClientSurvey.razor page on my website.
With ASP.NET MVC before I don't have to rebuild the project when I add a new aspx page. Does it still work with Blazor WebAssembly? If yes, how can I change the razor page, and it can update on my website automatically without rebuild or recompile?
And I also meet a problem that when I deploy the project in IIS, I don't see where the UI (.*razor) pages are stored, I know they are compiled to dll. How can I keep them in raw files in the same way with ASP.NET work? With ASP.NET, when I deploy it in IIS, there is always a folder to store aspx pages.
Updated: please see the figure to more clearly

Cumulocity File Repository

I am trying to load a csv file in the Cumulocity -> Administration - > Management - > File Repository. My objective is to access the file contents in the HTML widget and show the data in tabular or chart format.
I tried using the fetch() method to use csv file url , but it was not able to fetch the file. The file I believe has been locally stored into the Cumulocity platform now. How can I access the file via fetch().
You are trying to abuse the HTML widget for something it wasn't designed for.
Instead of hacking such logic into the HTML widget you should just extend the Cockpit application with your own widget which is honestly not much more difficult using the WebSDK. https://cumulocity.com/guides/web/introduction/
There is a XSRF protection to prevent exactly what you are currently trying: Bringing in custom javascript code into the live application and trying to access the platform API by "hijacking" the cookies of the logged in user (and you would either need the cookies or hardcode some credentials as you cannot access the API unauthenticated).
If you use the SDK there is even a proper Angular service in order to fetch the file for the API.

Kentico, module with web part to upload CSV

I have a requirement to upload data a from CSV file into custom table in Kentico, I have created a custom table but don't know how to upload CSV and process it, I have also created a web part which I can use to upload CSV and Insert data into custom table but that web part is available on front end web page. I want user to login to Kentico backend first and then access a module and upload CSV file.
How can I build a module with a web part to upload a CSV file?
Kentico has quite well documented process of Custom modules creation:
https://docs.kentico.com/k11/custom-development/creating-custom-modules
What you are looking for is a module with custom UI:
https://docs.kentico.com/k11/custom-development/creating-custom-modules/manually-creating-the-interface-for-custom-modules
In here you are actually creating an ASPX template that will have any controls you need. You can add an ASP button and reuse code from your web part, or add whole web part to the template. If properly configured, module will run within administration and use template of your choosing along with appropriate code.

How to create ASP.NET page to act as a "proxy" for Silverlight WebClient?

I need to create an ASP.NET application to access a URL, when this application is live it is able to access the feed URL correctly as the clientaccesspolicy.xml and crossdomain.xml are on the server but only allow non-localhost connections so the debug version won't connect.
How do I create a file, so this kind of link:
http://localhost/feed.aspx?item=ItemName
Can be used to pass-through to the RSS feed service live URL like:
http://www.example.com/feed.aspx?item=ItemName
So that I can develop my application via localhost as I can add a clientaccesspolicy and crossdomain file to this application so my Silverlight Application can access the live RSS service, while being developed without having to deploy it online every time I need to see what the application will look like.
A dummy RSS file is not suitable as I need to see various "Items" from the Feed.
Your page, feed.aspx, must read the RSS feed you want Silverlight to display and display it.
Use an HttpWebRequest in your .aspx page codebehind to get the RSS feed data
Post the feed data out to the outgoing stream via Response.Write
Thus the page acts as a proxy. Your Silverlight app will read the data from your local page as if it was a regular RSS feed.