ketan patel

ketan patel

  • NA
  • 171
  • 9.6k

How to get HttpContext.Current in model using ASP.NET Core?

Mar 19 2018 7:02 AM
public string GetColumns()
{
string columns = "";
for (int i = 0; ; i++)
{
if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["columns[" + i + "][data]"]))
{
string c = Convert.ToString((HttpContext.Current.Request.Form["columns[" + i + "][data]"]));
columns += columns == "" ? c : "," + c;
}
else
break;
}
if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form["Columns"]))
columns = Convert.ToString(HttpContext.Current.Request.Form["Columns"]);
return columns;
}

Answers (1)