razza_b
asked on
server mappath C#
Hi
Does anyone know how to use the server mappath in a silverlight 4 enabled wcf?
Thanks
Does anyone know how to use the server mappath in a silverlight 4 enabled wcf?
Thanks
you want to do this in the WCF service ?
ASKER
yes thats where it will be.
ASKER
i need to point to a repo..
"\\SR-SCO-D10\\Labels\\Lab els.tfr"
"\\SR-SCO-D10\\Labels\\Lab
if it's hosted in asp .net web , then something like this should work,
HttpContext.Current.Server .MapPath(" ~/somefile .txt");
remeber that [AspNetCompatibilityRequir ements(Req uirementsM ode = AspNetCompatibilityRequire mentsMode. Allowed)]
atribute should be there
HttpContext.Current.Server
remeber that [AspNetCompatibilityRequir
atribute should be there
You can return a string from WCF Service similar as HttpContent.Current.Server .MapPath(" ~/Labels/L abels.tfr" ) and get the value in SL calling the same service
ASKER
Hi i wont be back online until monday to try examples, niteshl what is your example like?
Razza,
Did not get your question..
Did not get your question..
Hai ,
HttpContext.Current.Server .MapPath(" .") will give you the current working directory.
HttpContext.Current.Server .MapPath(" ~/App_Data /sample.tc l");
Or you can use like this also ,
HostingEnvironment.MapPath (".");
You can follow this link also ,
http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx
HttpContext.Current.Server
HttpContext.Current.Server
Or you can use like this also ,
HostingEnvironment.MapPath
You can follow this link also ,
http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx
when you are doing with asp.net you can user mappath function as shown below
HttpContext.Current.Server .MapPath(" ~/somefile .txt");
other wise you want to do in silverlight and wcf ria services use below syntax,
string filepath = HostingEnvironment.MapPath (filename) ;
FileInfo fi = new FileInfo(filenpath);
HttpContext.Current.Server
other wise you want to do in silverlight and wcf ria services use below syntax,
string filepath = HostingEnvironment.MapPath
FileInfo fi = new FileInfo(filenpath);
ASKER
Hi Guys thanks for all your feedback.
i need to use UNC \\ rather than ~ relative path
so if the repo.tfr resides in e.g. 10.148.22.35 server and within the C:\...\...\Labels.tfr directory
could i still get access? and i think i might need to use this if its for silverlight wcf...
form.Repository = HostingEnvironment.MapPath ("\\..\..\ ..\")
Thanks
i need to use UNC \\ rather than ~ relative path
so if the repo.tfr resides in e.g. 10.148.22.35 server and within the C:\...\...\Labels.tfr directory
could i still get access? and i think i might need to use this if its for silverlight wcf...
form.Repository = HostingEnvironment.MapPath
Thanks
You wouldn't need to use MapPath on a UNC... A UNC is an absolute path = )
ASKER
Hi kaufmed in what way would it be used?
Just assign the server path like form.repo = unc server path ??
Just assign the server path like form.repo = unc server path ??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.