admin管理员组文章数量:1125360
[HttpGet]
public ActionResult PopulateSearchFields(string Id = "", string FreeText = "", string Subject = "", string IdType = "", string IdNumber = "",
string AccessionNumber = "", string Branch = "", string RRVisitNumber = "", string HealthSource = "", string HealthFactor = "")
{
string indexPageURL = $"/User/Index?Id={HttpUtility.UrlEncode(Id)}";
return Redirect(indexPageURL);
}
This function interact "Index function" , I debbuged and check "Id" parameter and the value is not null, but from some reason when I redirect to Index function Id inside "Index" get null value.
public virtual ActionResult Index(string Id)
//CommonConsts.GlobalSettings = SystemMethods.GetGlobalSettings();
{
try
{
Systems.GlobalSettings = SystemMethods.GetGlobalSettings();
ViewBag.Version = UtilityMethods.GetVersion();
ViewBag.Subjects = ConnectionsMethods.SubjectsFromDB();
var Districts = ConnectionsMethods.DistrictsFromDB();
var startDistrict = new District() { REF = "-1", Name = "" };
Districts.Insert(0, startDistrict);
ViewBag.Districts = Districts;
UserAD userAD = UserMethods.UserADByLoginFromDB(User.Identity.Name.Substring(
User.Identity.Name.LastIndexOf("\\") + 1), true);
ViewBag.UserAD = userAD;
ViewBag.UserName = userAD.UserFullName;
ViewBag.Settings = SystemMethods.GetSettings(userAD);
ViewBag.Theme = ViewBag.Settings.Theme;
ViewBag.Branches = ConnectionsMethods.FetchNamesOfBranches();
ViewBag.HealthFactors = ConnectionsMethods.FetchHealthInsuranceFactors();
ViewBag.InsuranceFactorSources = ConnectionsMethods.FetchHealthInsuranceSources();
ViewBag.IdTypes = ConnectionsMethods.FetchIdTypes();
ViewBag.MessageIcons = ConnectionsMethods.GetMessageIcons();
ViewBag.RefreshTime = Systems.GlobalSettings.RefreshTime;
ViewBag.UserMetricsTag = Systems.GlobalSettings.UserMetricsTag;
ViewBag.LoadProjectsCnt = Systems.GlobalSettings.LoadProjectsCnt;
ViewBag.Users = new SelectList(UserMethods.UsersAdFromDB(), "Value", "Text");
ViewBag.AwayInterval = Systems.GlobalSettings.AwayInterval;
ViewBag.Tabs = BuildTabs(userAD);
ViewBag.HasAutoSearch = 0;
var autoSearch = new AutoSearch(Id);
if (UtilityMethods.IsAutoSearchEnabled(autoSearch))
{
ViewBag.HasAutoSearch = 1;
ViewBag.AutoSearch = autoSearch;
}
}
catch (Exception ex)
{
Systems.logger.Error(User.Identity.Name + " " + ex.Message);
}
return View();
}
Is someone know why it happnes? I can call index directly but I want to get more elegant code
本文标签: cTrying to redirect with function parametersStack Overflow
版权声明:本文标题:c# - Trying to redirect with function parameters - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736653822a1946205.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论