HI All,
Its Urgent..
Im able to display images from specific image folder. but i need to display images from sub folder too.
design code:
SlideShowServiceMethod=" AutoPlay="true" Loop="true" PlayButtonID="btnPlay" StopButtonText="Stop" PlayButtonText="Play" NextButtonID="btnNext" PreviousButtonID="btnPrevious" | ||
Name: Description: | ||
front end:
[WebMethod]
[ScriptMethod]
public static Slide[] GetImages()
{ List slides = new List();
// string path = HttpContext.Current.Server.MapPath("/Image/" + "CurryMasala-11/"); //("~/Image/CurryMasala-11/");
// string path = Server.MapPath("~/Curry Masala/");
string path = HttpContext.Current.Server.MapPath("~/Image/"); //Path.Combine(HttpRuntime.AppDomainAppPath, "~\Image");
if (path.EndsWith("\\"))
{
path = path.Remove(path.Length - 1);
}
Uri pathUri = new Uri(path, UriKind.Absolute);
string[] files = Directory.GetFiles(path);
foreach (string file in files)
{ Uri filePathUri = new Uri(file, UriKind.Absolute);
slides.Add(new Slide
{Name = Path.GetFileNameWithoutExtension(file),
Description = Path.GetFileNameWithoutExtension(file) + " Description.",
ImagePath = pathUri.MakeRelativeUri(filePathUri).ToString()
});
}
return slides.ToArray();
}
Munesh SharmaRank #174 · 13.9K reputationPosted Apr 19, 2014, 11:39 AM EDT
The ResolveClientUrl method will automatically resolve the correct path starting off from the root of the app (~/)
Black cats3 reputationPosted Apr 19, 2014, 9:32 PM EDT