バックグラウンドで何かを行うメソッドを呼び出したいのですが、現在のビューを変更したくありません。これは方法です:
public ActionResult BayesTraining(string s,string path)
{
XmlParse xp = new XmlParse();
using (StreamWriter sw = System.IO.File.AppendText(path))
{
sw.WriteLine("d:/xml/"+xp.stripS(s)+".xml");
sw.Close();
}
return RedirectToAction("Index");
}
ご覧のとおり、私は現在 RedirectToAction を使用しています。これは、メソッドが機能した後にページをリロードするだけです。メソッドが UI に影響を与えないことを念頭に置いて、使用するたびに Web ページを更新したくありません。その仕事はバックグラウンドで行われるべきです。では、ビューをリダイレクトする必要なく、どのように呼び出すことができますか?