[WebMethod]
[ScriptMethod]
public static Slide[] GetImages()
{
List slides = new List();
string path = HttpContext.Current.Server.MapPath("~/images/");
/*
but while i drag that folder in cs file it is like http://localhost:65185/image/
*/
//Page.ResolveClientUrl(path);
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();
}
Bikesh SrivastavaPosted Oct 19, 2016, 6:05 AM
sowjanya bommithiPosted Oct 19, 2016, 2:43 AM
Salman BegPosted Oct 17, 2016, 4:46 AM