コントローラは次のとおりです。カミソリ仮想パス問題
public class HomeController : Controller
{
public ActionResult LogOn()
{
return View();
}
[HttpPost]
public ActionResult LogOn(string captcha)
{
if (captcha == HttpContext.Session["captcha"].ToString())
return Content("ok");
else
return Content("failed");
}
public CaptchaImageResult ShowCaptchaImage()
{
return new CaptchaImageResult();
}
}
図である。
<%using (Html.BeginForm())
{ %>
<p><img src="/Home/ShowCaptchaImage" /></p>
<p>Please enter the string as shown above:</p>
<p><%= Html.TextBox("captcha")%></p>
<p><input type="submit" value="Submit" /></p>
<% } %>
すべてがうまく、キャプチャ画像がレンダリングされて行く(CaptchaImageResultは、応答ストリームにJPGを書き込みます)。しかし、私がカミソリビューエンジンを使用する場合、キャプチャ画像はレンダリングされません。
修正方法?
さらにもう1つ:キャプチャを表示するには良い方法ですか?
後で編集:<img [email protected]("../../Home/ShowCaptchaImage") />
が問題なく動作します。それがこのブラウザは、のルートから/Home/ShowCaptchaImage
を要求する原因となるので、最初の例では、私は、Visual Studio開発サーバーを使用していた2つ目に、私が使用したIIS
剃刀ビューエンジンを使用するとき、返されるHtmlはどのように見えますか? –