How can you vary an image using msdeploy? - publish

I have a web application I want to publish to multiple different clients, each with their own logo. I'm using 'publish web' from visual studio to do my deployment.
The only way I can think to change it is to have a setting in web.config which I use to decide which logo to display, but this doesn't seem very nice, not least because I'd have to deploy all the logos to every site.
Is there a correct or just better way to achieve this?

There is no way to do this in a single deploy without also uploading all your images. However, you can do it with two deploys:
Deploy the site while skipping logo.jpg (and optionally your logos folder if it's stored inside the web root)
Deploy just the file as a different filename:
_
msdeploy.exe -verb:sync ^
-source:contentPath=path\to\src\images\logos\logo1.jpg ^
-dest:contentPath=sitename\images\logo.jpg

Related

Adding media (jpg, mp3, mp4) to a web page from an outside source

I have a webserver running on a storage server and I am looking to access some of the media on it (ie. use an image from the nas as a background on the page). I have tried this with no luck:
background-image:url("file://SERVER01/Media/Family/5102.jpg");
as well as other variations, such as:
background-image:url("file:///SERVER01/Media/Family/5102.jpg");
background-image:url("file://../Media/Family/5102.jpg");
background-image:url("file:///../Media/Family/5102.jpg");
When I access the page from my laptop, the background image is broken, but if I look at the source and copy the link (Only the ones with SERVER01 in them) directly in, the image pops up fine.
What is the best way of troubleshooting this? What is the safest way of using these images without compromising the security of my server?
In order to access files on your remote server you will need to use a public facing hostname & URI, you cannot use local file paths outside of the doc root because it will not be visible to the client / website user.

threepenny-gui - opening files

Dear Haskell community I have written my first gui application and decided to use
threepenny-gui to do so.
The task is the following search the files in a given folder for matches and provide links to open those files. In addition I made nice parse and render function as the files (mostly) have a special formatting.
But now I have stumbled upon a problem - most browsers prohibit links to local files by href="file://localhost/home/user/folder/file.pdf" being opened, for security reasons, which I do understand and find completely sensible.
I tried to use href="./file.pdf" when the program and the file are in the same folder, which also doesn't seem to work.
The code of the whole application is available at github/epsilonhalbe, I run it in a folder and access it via a browser at localhost:100000
The HTTP server provided by threepenny-gui will serve up static content from the directory you specify in tpStatic. Put your files in that directory, and make your links' paths be relative to it, and you'll be good to go!
As of threepenny-gui-0.4.*, there are also two functions loadFile and loadDirectory that can be used to serve a local file or directory at an automatically generated URL. This can be useful if the tpStatic field is not enough.

How can I find my working directory?

You'll have to bear with my slightly on this, but please ask if I have left out any pertinent information. I have just taken over a project to create a dashboard for my team. This dashboard has been made using a niche third-party tool that nobody here will have used before. The third party tool auto-generates some code to display "markers" on a webpage. "Markers" being some proprietary code to query a database/apply custom styling etc.
I am trying to display a webpage within the page that has been generated, and I’d like to point this to a local webpage (ie on my C drive). If I pass it an absolute path, then this results in a warning in IE9 as I am mixing data sources - a https website pointing to a http web page. It will display after ignoring the warning, but my userbase is not comfortable enough with computers to ask them to do this.
I believe if I pass it a relative path then it should work, but I can’t find out what directory to base this path off and it doesn’t appear to be anywhere obvious. So, in my current page I have an image with the web address of : https://website:8443/websitereport/images/buttons/locked.gif. What I need to know is where the “websitereport/images” folder is stored so that I can put my webpage in there to give the webpage a relative path. The HTML for this image is :
<img id="dvp_locationbar_lock" class="dvp_imagebutton" style="" dvp_title="ui.tip.lock-page" dvp_image="locationBarPageUnlockedImage" src="/websitereport/images/buttons/unlocked.gif" title="Lock this page">
What are my options for discovering where this folder is stored locally? I am running Apache Tomcat 7.0. It is not displaying if I use the path based off
C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\work\Catalina\websitereport
of
\websitereport\page.html
And I cannot find it anywhere obvious in the Apache folder. I have tried :
Searching - no results.
Using PHP to print the current working directory - cannot find out
where to edit the webpage.
Looking at images/information on the existing webpage. They all point
to folders I cannot find.
Inspecting with firebug.
In short, you can't rely on the files being on disk at all - they might be just contained in a *.war file, containing the whole application. Or they might be generated on-the-fly, despite the name sounding like an actual file.
Also, you should not arbitrarily write within a directory even if you find it (my closest guess would be tomcat's webapps/websitereport/ directory if it exists) because nobody will know that something changed during the time since last deployment. So, on the next update of the application, you'll end up overwriting all of your changes again. You typically change the underlying application and redeploy.
You might also find a few references in tomcat's conf/localhost/ directory or even in conf/server.xml, but it all depends on how your server was administered

deploy website to cd - paths

what's the best way of porting a static HTML website to a CDROM, to allow users to insert the disk, copy the files off, and then run the site "offline", as it were.
what sort of path structure should i use? at the moment all of the assets are like:
file:///C:/Users/User/Desktop/MySite/index.html
which obviously isn't very portable
thanks for any info
You should use relative paths, like
index.html
and
images/img.gif.
If you have many absolute links, search for "file:///C:/Users/User/Desktop/MySite/" and replace all with "" (or "./", to make things clearer). Notepad++ can search across all files of one directory.
To make things even clearer, create a subdirectory with all files and more subdirs and optionally an index.html in the root directory, so the user only has to copy one folder (plus one index.html).
You can try to use portable web-server application.
This application allow to run any websites on any drives (USB-Flash or CDROM). The main advantage that you shouldn't to change links from absolute paths to relative. Also, the application will open your sites if that uses a database or PHP.
For example: XAMPP (Portable Web Server) and many others.

ImageLoading relative path problem in Flash

I'm trying to load images from a relative folder /media/one.jpg but it never loads, I use the same script to load from my local folder and it does.
The absolute path e.g c:/mydir/one.jpg does not work either. Earlier I used to throw things at my server and get jpegs from there. But for testing purposes I need these images locally available.
Any Idea?
Just solved it Use loadImage("media\ears.jpg"); double slash instead to single and it works :)
For security reasons flash files can access only web or only local files, with can be set in the project properties. If you want to build a web application like a webpage or just a part of a webpage, than you should choose network only, but this way you can test your work only on a webserver (that can be localhost too ). If you want to build a desktop application, witch has no relation to web, then select the "local only" option in your project properties.