static files move to another server

383 Views Asked by At

Develope using ASP.NET MVC

I have a website (Web Server) contains many pages and many static files (photo, css, ...).

Now I want to move these static files to another server (Resource Server).

[Reason: To Reduce the I/O loading on Web Server]

So, I need to process all the relative path in the pages

Then it can loading imgs(or other static files) from Resource Server after process

(e.g. <img src='/Content/Images/myPhoto.jpg' />)

p.s. Some imgs are generate dynamically by javascript.

and I don't want to use @Razor

Is there has any efficient or easily way to solve it.

(maybe like CDN's processing way but not use CDN service)

I had not process similar problem like it.

Hoping everybody can give me some suggestions. Thanks a lot!

2

There are 2 best solutions below

1
On

You are describing a CDN or Content Management System. These are easy to combine with Razor, so I dont see any reason not to use existing methods to solve your problem.

There is a reasonable guide to doing this already on Stack Overflow. Best way to switch between static assets and CDN based assets for development and deployment

Did you search for ASP.net Razor CDN before posting the question ?

1
On

multi way to solve it : 1. you can create NetBIOS in server and chenge saved path for file with the simple code and run it success 2. just change path file in database with query and page file path(img-src, etc) 3. use javascript to change path (replace currect path) in load page (but this way is not optimal)