diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs
index 0e82cee9..43804f3b 100644
--- a/web/Controllers/AccountController.cs
+++ b/web/Controllers/AccountController.cs
@@ -24,7 +24,7 @@ namespace Yavsc.Controllers
///
public class AccountController : Controller
{
-
+
string avatarDir = "~/avatars";
string defaultAvatar;
string defaultAvatarMimetype;
@@ -37,20 +37,7 @@ namespace Yavsc.Controllers
[AcceptVerbs (HttpVerbs.Get)]
public ActionResult Avatar (string id)
{
- if (id == null)
- return new EmptyResult ();
-
- ProfileBase pr = ProfileBase.Create (id);
- var avpath = pr.GetPropertyValue("Avatar");
- if (avpath == null) {
- FileInfo fia = new FileInfo (Server.MapPath (defaultAvatar));
- return File (fia.OpenRead (), defaultAvatarMimetype);
- }
- string avatarLocation = avpath as string;
- if (avatarLocation.StartsWith ("~/")) {
- avatarLocation = Server.MapPath (avatarLocation);
- }
-
+ string avatarLocation = Url.AvatarUrl (id);
WebRequest wr = WebRequest.Create (avatarLocation);
FileContentResult res;
using (WebResponse resp = wr.GetResponse ()) {
diff --git a/web/Helpers/YavscHelpers.cs b/web/Helpers/YavscHelpers.cs
index aa5d4053..1b554045 100644
--- a/web/Helpers/YavscHelpers.cs
+++ b/web/Helpers/YavscHelpers.cs
@@ -151,10 +151,18 @@ namespace Yavsc.Helpers
/// Helper.
/// Username.
public static string AvatarUrl (this System.Web.Mvc.UrlHelper helper, string username) {
+ if (username == null)
+ return null;
ProfileBase pr = ProfileBase.Create (username);
- var a = pr.GetPropertyValue("Avatar") ;
- if (a == null || a is DBNull) return "/avatars/" + helper.Encode(username)+".png";
- return helper.Encode ((string)a);
+ object avpath = null;
+ if (pr != null) avpath = pr.GetPropertyValue("Avatar");
+ if (avpath == null) return "/bfiles/"+username+".png";
+ string avatarLocation = avpath as string;
+ if (avatarLocation.StartsWith ("~/")) {
+ avatarLocation = helper.RequestContext.HttpContext.Server.MapPath(avatarLocation);
+ }
+ return avatarLocation;
+
}
}
}
diff --git a/web/Models/App.master b/web/Models/App.master
index 63ee0f0f..24f09c2d 100644
--- a/web/Models/App.master
+++ b/web/Models/App.master
@@ -80,15 +80,12 @@ $(document).ready(function(){
<%=ViewState["orgtitle"]%>
- -
-"><%= YavscHelpers.SiteName %>
-
+"> <%=ViewState["orgtitle"]%>
-