Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.40 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Impersonation and Delegation within a MVC 3 application on IIS 7.5
  2. public ActionResult Upload(HttpPostedFileBase file)
  3. {
  4.   var savedDirectory = "\PathToServer2";
  5.  
  6.   if (Directory.Exists(savedDirectory))
  7.   {
  8.     file.SaveAs(savedFileName);
  9.   }
  10.   else
  11.   {
  12.     Directory.CreateDirectory(savedDirectory);
  13.     file.SaveAs(savedFileName);
  14.   }
  15.  
  16.   return RedirectToAction("Action", "Controller", new { id = 1 });
  17. }