c# - Getting the link for a virtual directory -



c# - Getting the link for a virtual directory -

i have written server in c# js client. solution consists restapi bl , dal.

the bl creates links images stored on virtual directory, on server. js , server code, stored in same directory.

when build string of link utilize line of code:

string keyimagename = settings.default.serverurl + settings.default.keyimagesfolder + relatedfinding.keyimagepath;`

where keyimagefolder virtual directory.

it works fine, problem website has multiple amazon instances, 1 each geographical zone , every time deploy, need alter ip in settings.it's annoying.

is there way virtual directory's url, each machine?

if js installed on same machine server, need total path?

many thanks

first, you'll need physical path file or directory want generate url for. can done within page object using request.applicationpath.

next, path can converted url path using server.mappath function. take business relationship if there more 1 websites tied same path in iis.

var physicalpath = path.combine(request.applicationpath, settings.default.keyimagesfolder, relatedfinding.keyimagepath); var resourceurl = server.mappath(physicalpath);

c# asp.net

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -