.web 부분의 Microsoft Visual Web Developer 2010 Express에서 ASP.NET 프로젝트를 만들고 Silverlight 프로젝트가 포함되었습니다. 나는 음악 블로그와 같은 것을 만들었고 Silverlight에 "경로"값을 전달하려고합니다. 사용자가 파일을 업로드하면 트랙이 Silverlight 앱에서 재생됩니다.ASP.NET에서 Silverlight 응용 프로그램으로 값 전달
예를 들어 Posts라는 테이블과 Track이라는 Post에서 파생 된 테이블을 만들었습니다. 여기에 파일 경로가 저장됩니다. 나는 또한 내 Index.aspx 파일에 포함되어 있습니다 :
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Posts model, HttpPostedFileBase file)
{
if (ModelState.IsValid)
{
if (file != null)
{
if (file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Music"), fileName);
file.SaveAs(path);
Track track = new Track();
track.Path = path;
model.Track.Add(track);
DateTime today = DateTime.Today;
Posts post = new Posts();
/*post.Body = model.Body;
post.Created = model.Created;
post.Modified = model.Modified;
post.Title = model.Title;*/
model.Created.ToLocalTime();
postRepository.Create(model);
return RedirectToAction("Index");
}
else
{
ModelState.AddModelError("", "The given Path is invalid");
}
}
else
{
ModelState.AddModelError("", "The given Path is invalid");
}
}
return View(model);
}
이 어떻게 실버 라이트 플레이어에 지금의 경로를 통과 할 수있다, 그래서 나는 재생할 수 있습니다 : 포스트를 만들 때
<form id="form1" runat="server" style="height:50%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="770" height="530">
<param name="source" value="ClientBin/MusicBlog.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40818.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Holen Sie sich Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
I 전화 ASP.NET 페이지에 포함 된 Silverlight 앱에서
바탕 화면에 Microsoft에서 Silverlight를 버린 것을 알고 계십니까? – Rob