TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sowjanya bommithi
NA
14
3.1k
in slideshow server.mappath not identify the path
Oct 17 2016 3:34 AM
[WebMethod]
[ScriptMethod]
public static Slide[] GetImages()
{
List<Slide> slides = new List<Slide>();
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();
}
Reply
Answers (
3
)
What is different between .append and .html
gridview updating