Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have main domain www.abc.com and subdomain crm.abc.com I want to upload an image from subdomain to main domian directory -- www.abc.com/images/users

What I have tried:

string foloderLocation = Server.MapPath("~/images/users/" +filename);
Posted
Updated 9-Oct-18 8:20am

1 solution

The simplest option would be to use IIS to add a virtual directory in the CRM site pointing to the folder on the main site. You could then use MapPath to get the physical path of the folder:
string folderLocation = Server.MapPath("~/main-site-images/users/" + filename);

If you can't do that for some reason, then you'll need to specify the physical path directly. You'll probably want to put it in your config file, so that you don't have to recompile every time the path changes.
string folderLocation = System.IO.Path.Combine(WebConfigurationManager.AppSettings["mainSiteImagesPath"], "users", filename);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900