I have a question related to my ASP.net MVC 3 application. My web app allows users to upload files to Amazon S3 and other members to access them. I wish to have control over who can access these file. To do this I dont want to expose the URI's of the files and I would perfer not to have the server proxy the file.
Can someone suggest the best ways to achieve this?
S3 allows you to create a signed url which has a time expiration. This appears to have been covered completely here: Creating expiring links to S3 or Cloudfront hosted content with ASP .Net
One way would be to use the AWS SDK for .NET and call the GetPreSignedURL method which will generate a temporary url with querystring authorization. Another option would be to point your images to a secured MVC route which does a 301/302 redirect to the image url (could also be a presigned url).
Related
I'm using Ninja Forms WP Plugin which allows files to be attached to forms and uploaded. It stores them in the wp-content/uploads directory on the server but not in the media library.
I'm trying to programmatically (from a remote server) fetch them from there and then delete them.
I can see there are endpoints in the REST API to access the media library, but I can't see anything about accessing uploaded files that aren't in the media library. Is there any way of doing this?
If not, what would be the best way to access these files? I guess I can fetch them with a standard HTTP request but how could I delete them?
You could register a custom WP API endpoint like /wp-json/custom-delete-file (see https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/) that does the actual work of deleting the files on the servers file system. For authentication the easiest way would probably be to create a dedicated WP User (e.g. APIUser) whoms credentials (username and password) are then send upon each request to your endpoint, utilizing basic authentication (of course via SSL).
I have two static websites located in two separate local directories.
I also have a secured web app with spring mvc. There are two users, each user is related to a different website.
I want to serve the relevant website/pages for each authenticated user from the same url.
How can i do that? Can i use custom Servlet/Controller?
I think your requirements are like you have a Web app for authentication and after authentication and authorisation you want to redirect to another application which is hosted in another server. You could use controller for that in spring and depends upon the logic you can have different views
We have a ASP.NET MVC4 WebAPI Portal RIA (a mouthful, I know). The Portal UI is implemented using extjs and static html (ie no views), and all dynamic behavior is driven via RESTful JSON service end points implemented via the System.Web.Http.ApiController. Currently, the website is deployed in production as a single site with two site bindings (ie two different URLs) in IIS: one URL is internal and provides access to the full portal, the other is HTTPS and is intended to provide external authorized users access to the RESTful JSON API portion of the site. Effectively, this means that while the internal URL allows full access to the site, ideally, the external URL should:
Only allow respond to JSON requests
Not allow access to the default page (eg index.htm)
What is the best way to accomplish this goal in IIS or otherwise? Is there a better alternative to the shared site with multiple site binding configuration we are currently using? Any insight would be deeply appreciated.
Probably the easiest solution (from all those that involve coding your own solution) would be to implement an HTTP Module that intercepts all calls and do all the filtering logic in your code based on the domain name or IP.
Here is a very simple example of how you can do that: Using ASP.NET HTTP Modules to restrict access by IP address
I am not aware of any way to accomplish your task purely by changing a configuration.
I have a web app made in asp.net mvc3. There is a facility to upload and download files using the application. Uploaded files will be stored in some folder under web root. I want allow downloading files to those who have access to the files only. No one should be able to download the file by directly pasting in the file URL.
I use shared hosting with limited IIS access. So what would be the best way to achieve this?
How are you storing the data on the access rights currently? It sounds like you are not going to be able to make use of IIS to control access to your files and will have to handle it yourself.
As this is the case, rather than link to the file directly you should store the files outside of your web root and then handle requests coming in for files through ASP.NET MVC using a GET method. At that point you can check the user's credentials, and if they have access you can serve the file.
I'm not too familiar with it, but it looks like ASP.NET MVC makes serving up files very easy with the ability to return a FileContentResult, supported by the Controller.File method (documentation here).
This blog post looks like a great start, and you would just need to insert your credential-checking logic into the Get method.
My website (developed in ASP.NET) and has 75 GB of images and those are served along with web application. Meaning there are on the same server.
Now I want to move all the images to an external server and using another domain. This new domain is specifically just to server images.
If I move all my images to another domain, I will lose SEO (Google indexed) results.
Considering this situation, please help me out with the following.
Which web server is better to serve images very fast? Which Operating system and web server combination is better to serve this purpose?
If images are moved to another domain, what is the alternative way that I can still have the same URLs for the existing images? Is there any facility to give alias name that will point out to the new domain?
Since the advent of ASP net MVC MS have Routes helpers
Since MVC it's build on top of ASP.net you can use id to redirect to the url of the images to the another domain
http://msdn.microsoft.com/en-us/library/cc668201.aspx
Using ASP.NET routing to serve static files