how to serve all static images on my asp.net website separately - asp.net

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

Related

How to setup an ASP.Net/IIS Web Application to serve static content from a cookieless domain

In my quest to get the best performance for an ASP.Net/IIS based web application, I would like to have static content be served up from a cookieless domain as suggested by Google.
I have followed this discussion and understand how it would work. Stopping cookies being set from a domain (aka "cookieless domain") to increase site performance
What I fail to understand is how to have the image/js/css files' src point to the new domain name instead of the one resolved by the browser when served up from the original web application.
Here is what I mean -
Original Web Application in IIS at myapp.mydomain.com
Cookieless Web Application in IIS at static.mydomain.com
img tag in a web page is served to the browser from the original Web Application as src="Images/someimage.jpg" which the browser automatically resolves to myapp.mydomain.com/Images/someimage.jpg
The problem for which I am looking for a simple and a smart solution -
Across the application, how do I get the img and asp:image to serve absolute URLs instead of the relative URLs. i.e. have the img tag get the absolute URL as src="//static.mydomain.com/image/someimage.jpg"
PS: I have also referred to How do I setup IIS with a cookieless domain to improve performance? and lot of similar contents, but all of these are tell you what is to be done, but not the how to implement at the ground level.
You will have to provide the fully qualified url:
src="//static.mydomain.com/image/someimage.jpg"
or
src="http://static.mydomain.com/image/someimage.jpg"
I don't see any other way around it.

Difference between creating my asp.net MVC web application ,under the IIS Default web site, or create it as a new web site

I have published my asp.net MVC web application under the “Default web site” inside IIS. I actually added two versions of my web application:-
one directly under the default website and it can be accessed by typing http://servername
one under presaging path , and can be accessed by typing http://servername/prestaging
so I got confused on which approach it is recommend to add my asp.net web application, and what is the difference between adding my web application under the default web site, or creating a whole new web site ?
Thanks
This has more to do with organization within your company's IIS structure than right and wrong. If the site you built truly is the only site on the server, putting it on the Default site is not looked down upon.
But if the application is a sub application of the default site, the latter approach is the more appropriate approach if you only get to access the site from the //servername URL.
If you have a separate domain, myapp.servername.com, you can install it into the default iis site and add a binding or you could create a whole separate web site.
Has more to do with your structure than right or wrong.
Edit
To answer your comment, creating the site under the default web site will make the URL in most cases be: 'http://myservername/MyApp'. Creating your own application would require (in most cases) a separate binding address, 'http://myapp.myservername.com' It is really only affecting the URL you place in your browser and nothing else. More complicated setups are possible, but for most cases, these are your two options.

Sharepoint site as a subsite under a asp.net site

I have asp.net hosted at my domain which i access using a url like 'http://www.xyz.com. I have other web applications which are under the root web application in virtual directories which can be accessed using a url like 'http://www.xyz.com/subsite1 etc.
Now i want to have a sharepoint site as a subsite under my root website which i can access using a url like 'http://www.xyz.com/sharepointsite1.
I have installed sharepoint 2010 server.This installed a new website Sharepoint-80 and The central administration site. I have changed the Sharepoint-80 website setting to point to wwwwroot where my asp.net wesite and its subsite files are located. Now if i make a new site collection in my sharepoint site and it gets successfuly created. But when i browse it i get following error.
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
My webserver is also a domain controller. How do i resolve this issue? And how do i achieve the main aim of having a sharepoint site as a subsite under my main website?
Thanx
I don't think that is possible, unless you are using different host headers or you can write an HttpModule which would be complex in my opinion. Although reverse is possible, You can have a sharepoint site at / and then an ASP.NET site at /subsite
The reason is an IIS SharePoint website is different from IIS ASP.NET website. IIS SharePoint Website registers an extra SPRequest module which fetches the data from SharePoint content database. When you request / , it will always try to pull this data from the SharePoint Content database.
In your case, where you have changed the SharePoint-80 website to point to wwwroot, you have essentially removed SPRequest module from the pipeline. That's the reason you get the error, because its not able to pull the content from the database.
You should do the other way around. Change main site to Sharepoint site, and let your other asp.net application/site to be subsite of sharepoint.
You cannot do that. Simply because you're trying to encapsulate a cloud-based system into an internal IIS folder structure.
You can not add Sharepoint online page in an iframe because of the same origin policy that most of the sites on internet adopted this days. This is mainly for security reasons to avoid from web attacks like Clickjacking and XSS.
You can not add Sharepoint online page in an iframe because of the same origin policy that most of the sites on internet adopted this days. This is mainly for security reasons to avoid from web attacks like Clickjacking and XSS.
If you want to display the content of the sharepoint online into different domain, than try to use provider hosted app in windows azure or develop a Napa sharepoint hosted app which can make cross domain requests in REST or ajax

Hide source of file download hosted on Amazon S3 using MVC3

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).

Orchard CMS (Asp.Net MVC) integration like additional area

Is possible to integrate orchard to existing Asp.Net MVC3 site like separate area?
Like this:
Web.proj
View
Controllers
Models
BackendArea
OrchardCMS files
As a result Orchard CMS will be using for storing resources (strings, images ets.) of main site and easy to manage resources.
Problems:
I don't whant to use virtual folders
on IIS.
Orchard CMS used own Global.asax,
web.config, earlier version of
NHibernate and different
IOC(Spring.net is used for main site)
Given the architecture of ASP.NET, not really or at least not cleanly. From what it sounds like, you are really just trying to use the HTTP interface of orchard in a sub-uri, which is possible by setting up a reverse proxy and forwarding requests to a different app living on a different site. See carlosag's article for a basic overview. Here are some protips:
make sure you ignore the route you are going to reverse proxy -- you don't want ASP.NET mvc kicking in and trying to route it.
Use a virtual directory on the main site where you are reverse proxying. This is where you setup the url rewrites and such.
Setup the orchard "site" running in a virtual directory under your fake site with the same name as your virtual directory -- helps fool IIS into building URLs correctly.
The other way around will be a lot more likely to succeed. What you describe was a non-goal for Orchard.

Resources