Serving shared images in ASP.NET MVC - asp.net-mvc

I'm working on a project that involves two web portals hosted on the same IIS 7.5 server:
(A) MVC4 web application for administration
(B) Mobile MVC4 web application with jQuery Mobile
Both are retrieving the data from the Web API based services hosted on other IIS server.
Now I'm about to add manipulation of images that are managed on Admin portal (A) and displayed to clients within Mobile app (B). Images will be added/changed dynamically with higher frequency.
I had two solutions in my mind:
Store all images in database on the server that hosts Web API as byte arrays, and send them on demand as base64 strings - render them on mobile app pages as base64 strings:
Can set any kind of security restrictions and integrate them well with MVC
Pages would be rendered in one request
Transferring from Web API to Mobile app
What happens to caching?
Store all images on the server that hosts both (A) and (B) in some shared folder, include them in rendered pages as regular tags.
No transfer between WebAPI and Web server
Caching of images
Several requests for each image on the page
Thing that I have to take in consideration as well is that there will be native iPhone app that will do the same role as mobile web app, meaning it should have access to same set of images.
Any thoughts would be appreciated on this, I'm looking for best practices solution, a guide, hints, or anything that I could use.
Also, if option 2. is suggested, what is the best place to store images to be shared between two portals?
Thanks!

I would recommend you going with option 2 and store the images on some shared folder. The best would be to have a specific application that will act as CDN hosting all your static resources. According to YSlow best practices this CDN should be hosted on a different top level domain than the clients, thus allowing cookieless access to those lowering the bandwidth consumption.

Related

Can I have multiple Progressive Web Apps on my site?

My company has a very large site made up of lots of distinct sections, each maintained by their own team (e.g. browse pages vs checkout).
Does it make sense to build a separate Progressive Web App for each section, or do we need to unify our approach and build only a single Progressive Web App?
Think about progressive web apps in the same way you think about native applications. Then think if makes sense to have separated applications and you'll get your answer.
Being specific with your question I think you distinguish between some kind of info pages and service pages you currently keep under the same domain. If this is so, be aware that progressive web apps are unique by origin (protocol + domain name + port) and need HTTPS enabled so keeping separated progressive web apps can incur in additional infrastructure costs.
Nevertheless, this does not mean the same teams you have now can not maintain different parts of the same application.
If you are moving from a legacy website to progressive web apps (PWA), then I'd suggest you start small. Build a serious but not mission-critical PWA that performs a single function and go through the development/deploy process of building a PWA with Service Workers (fast reload and offline), home page installation and push notifications. This is no different than introducing any new technology to an organization (e.g, cloud, microservices, devops, et al).
A progressive web application is an application. And that PWA can potentially be installed on the home screen of a smartphone. I don't think you want users to have separate apps/icons on their home screens for your web "site".
Imo, your website should be a collection of microservices that are accessed via the web, not really a collection of applications. This gives you much more flexibility and agility. Combining microservices with PWA can be quite compelling for both content producers and users.

Two azure websites (webapps) on same domain

I have a webapp running as an Azure website on http://www.example.com
I have controllers for www.example.com/signup and www.example.com/signin - all other stuff is put on subdomains, like username.example.com.
My question: is it possible to have another (azure) website running on http://www.example.com? E.g. with all the marketing pages etc.
Ideally I would like to give access to that second website to an external webdeveloper so that I don't have to worry that the webdeveloper have access to my main app.
Additional question: would that second website have to be asp.net? Could it be PHP? (e.g. a Wordpress site)
You can develop child projects within Azure Websites check here : A single web project hosting both the web pages and API
One web project for the web pages, and another for the API, deployed to different websites on different servers
One web project for the web pages, and another for the API that is deployed to the same servers as an IIS application (/Services). http://blogs.msdn.com/b/tomholl/archive/2014/09/22/deploying-multiple-virtual-directories-to-a-single-azure-website.aspx, not sure if it can use another platform.

How to secure the contents inside the scope of UIWebview in iPhone

To ellobrate my requirement, I'm have native iPhone application. In it i have UIWebview as part of my screen. This webview is loaded with an intranet web application link. which in turn have links to few more intranet applications. These web applications have cookie, cache, local storage data etc. These data are stored in my native application's sandbox file system. I would like to know how to make sure that these contents are secured wiht the application. The requirement is to double secure the content. Based on configuration i may be want to delete the information stored in the filesystem. To be in detail, i may be want to delete all the information from the intranet web application1 alone from the file system, leaving other data undisturbed.
Note: I may not be able to do any changes to the source of my intranet web applications.
kindly advise me on this.

What components of your site do you typically "offload" or embed?

Here's what I mean. In developing my ASP.NET MVC based site, I've managed to offload a great deal of the static file hosting and even some of the "work". Like so:
jQuery for my javascript framework. Instead of hosting it on
my site, I use the Google CDN
Google maps, obviously "offloaded" - no real work being performed on my
server - Google hosted
jQueryUI framework - Google CDN
jQueryUI CSS framework - Google CDN
jQueryUI CSS framework themes - Google CDN
So what I'm asking is this, other than what I've got listed...
What aspects of your sites have you been able to offload, or embed, from outside services?
Couple others that come to mind...
OpenAuth - take much of the authentication process work off your site
Google Wave - when it comes out, take communication work off of your site
In the past I've used Amazon AWS.
Their S3 service was cheap for hosting Images and video.
The EC2 service is also good for additional computational power or just removing load from your server.
In additon to Pay for hosted services you can use Youtube or Vimeo to host videos and they API will allow you to upload and host videos.
There are also APIs for may other services depending on exactly what you're wanting to do. If you looking at adding functionality to your site but without hosting the service it would be worth checking out http://www.programmableweb.com/
Even though Google's CDN has smaller files and faster response times, I'm now using Microsoft's CDN for jQuery. Why? Big Brother.
In some high-security companies, they only allow access to known domains. Users at those companies had problems because their firewalls didn't know googleapis.com, and blocked jQuery. They knew microsoft.com, so ajax.microsoft.com worked.
I've suggested to google that they change their URL from ajax.googleapis.com to something.google.com to avoid the issue in the future.

Budget NLB policy for 3 tier website needed

We have a few 'classic asp' client facing websites feeding off a central asp.net mvc site which acts as a webservice ie we query the MVC controllers directly from the ASP sites with extensive use of jquery ajax. This MVC site in turn queries sql server running on a seperate box. We have a custom session profile which requires a call to the database on every page view.
At the moment the client facing websites sit on the same box as the mvc site. We now want to use Windows 2008 network load balancing service to both contain high bursts of traffic and maintain availabilty. Within a currently limited budget...
What is the best policy: 2x2 - client sites on 2 NLBed boxes & MVC on seperate pair of NLBed boxes- or both on a single group of 3 NLBed boxes?
I would go with the 2x2 solution just to help keep those MVC sites away from the Web. If you do not need the MVCs kept away from the web then go with 2 or 3 NLB'd boxes.
Be aware that NLB is a IP to IP load-balancing solution so if you are funneled through a single connection it will end up always going to the same server and you really just get Fail over.

Resources