<p><a href="http://localhost:50034/Admin/Delete/723" rel="nofollow noreferrer">http://localhost:50034/Admin/Delete/723</a></p>

<p>Always needs this parameter to perform the action, however, if you go to the URL without the parameter, an exception occurs. How do you handle this and redirect back to the main page without doing anything?</p>

<p>Thanks.</p>

```
```
public ActionResult Details(int? Id)
{
     if (Id == null)
           return RedirectToAction("Index");
     return View();
}
```
```