using "~" route resolves c:\
i'm perplexing exercise server control frobs integrate files inside web office an asp.net site. i'm controlling vs web dev demonstrate 2008 ide. i httpcontext.current.request.applicationpath
route web bottom i those files, advantage c:. heck?
absolute paths work only fine, nonetheless i'd means feed server control family office only let it's thing. have i finished wrong?
public twine target
{
{ relapse _target; }
set
{
(value.startswith("~"))
{
// wtf? gives me c:\? why?
_target = httpcontext.current.request.applicationpath +
value.substring(1);
}
else
{
_target = value;
}
}
}
private twine _target;
protected overrule vacant render(htmltextwriter writer)
{
htmlcontrol coupling = new htmlgenericcontrol("div");
int filecount = 0;
try
{
directoryinfo dir = new directoryinfo(_target);
foreach (fileinfo f dir.getfiles())
{
filecount++;
= new htmlanchor();
a.attributes.add("href", f.fullname);
a.innerhtml = f.name;
wrapper.controls.add(a);
}
}
locate (ioexception e)
{
pitch e;
}
controls.add(wrapper);
base.render(writer);
}
Comments
Post a Comment