首先,我無法訪問控制器部分,它已經編譯的網站,我沒有源代碼只有 .dll
@using (Html.BeginForm("Details", "Shop", FormMethod.Post, new { role = "form"}))
{
<p>Select Character:</p>
if (Model.Chars != null && Model.Chars.Count > 0)
{
@Html.AntiForgeryToken()
@Html.ValidationSummary("", new {@class = "text-danger"})
if (Request.IsAuthenticated)
{
@Html.HiddenFor(x => Model.Guid, Model.Guid)
for (var index = 0; index < Model.Chars.Count; index )
{
var charInfo = Model.Chars[index];
var chdata = charInfo.Name " (lv." charInfo.Level ")";
if (index == 0)
{
<div>
@Html.RadioButtonFor((x) => Model.CharName, charInfo.Name, new {Checked = "checked"}) @chdata
</div>
}
else
{
<div>
@Html.RadioButtonFor((x) => Model.CharName, charInfo.Name) @chdata
</div>
}
}
}
<p/>
<input type="submit" class="position: center !important" value="Confirm Purchase"/>
}
else if (Model.Chars == null)
{
<h4 class="nk-title h4" style="color: red">To purchase items, you must first log in to your account</h4>
}
else
{
<h4 class="nk-title h4" style="color: red">You cannot buy items, you don't have any characters in your account</h4>
}
}
通常它應該在收到通知 BuyOk 時重定向到 Shop,如 _Layout.cshtml 中所述,但事實并非如此。
@{
var messages = ViewBag.Errors as List<ViewError>;
var notifications = ViewBag.Notifications as List<ViewNotification>;
}
@if (notifications != null && notifications.Count > 0)
{
<div class="alert" style="background: #00ff00">
@foreach (var message in notifications)
{
<span class="closebtn" onclick="this.parentElement.style.display = 'none';">×</span>
string msg;
switch (message)
{
case ViewNotification.BuyOk:
msg = "Purchase complete";
break;
case ViewNotification.ChangePwdOk:
msg = "Password change request successful, description sent to your email";
break;
case ViewNotification.ChangePwdSuccess:
msg = "Password Changed";
break;
case ViewNotification.ChangeEmailSuccess:
msg = "Email has been changed";
break;
default:
msg = "Unknown notification";
break;
}
@msg
}
</div>
}
沒有錯誤,但情況是 ViewNotification.BuyOk:它沒有被觸發,因此在按下提交按鈕后操作完成,沒有任何錯誤,但它不會重定向到 Shop
我想做的是在我按下確認購買后重定向到商店
PS:我只擁有編譯后的代碼,我嘗試使用幾個反編譯軟體進行反編譯,但到目前為止沒有運氣,我看不到真正的控制器,也無法編輯它
我希望有人可以幫助我解決這個問題,謝謝
uj5u.com熱心網友回復:
完成后,網站將被重定向,并且在 URL 的末尾添加了 isOk=False 或 isOk=True。如果 URL 中存在 isOk=True ,我使用 javascript 創建重定向。謝謝
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/490418.html
標籤:网 asp.net-mvc 剃刀
