---
title: "overload views in MVC?"  
description: "overload views in MVC?"  
author: "Jayden Bell"  
published: 2013-03-12  
updated: 2013-03-12  
canonical: https://www.mindstick.com/forum/658/overload-views-in-mvc  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 1 minute  

---

# overload views in MVC?

Hi Everyone!

I want to have links http://localhost:2409/Account/Confirmation/16 and that link http://localhost:2409/Account/Confirmation/ (without parametr).\
But with this [action](https://www.mindstick.com/forum/155752/what-is-action-result-with-its-types) [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best), it isn't working. Why?

[public](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) [ActionResult](https://www.mindstick.com/forum/33961/what-is-the-difference-between-actionresult-and-viewresult) Confirmation(int id, [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) hash)\
{\
Some code..

return View();\
}\
[second](https://answers.mindstick.com/qa/41761/how-did-the-second-industrial-revolution-influence-women-s-roles-in-society), I just want to return View, if parametr is empty.

public ActionResult Confirmation()\
{

return View();\
}\
[Error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) (translated):

The current [request](https://www.mindstick.com/blog/255/post-get-and-request-function-in-php) for action on a [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) Confirmation AccountController is ambiguous between the following methods of action:

System.Web.Mvc.ActionResult Confirmation (Int32, System.String) for type TC.Controllers.AccountController System.Web.Mvc.ActionResult Confirmation () for

type TC.Controllers.AccountController

Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Jayden!

You can not create same action name with same http verb(e.g. HttpGet).

You can overload view as following

[HttpGet]\
public ActionResult Confirmation(int? id, string hash)\
{\
if (id.HasValue)\
{ \
// put here some code\
return View();\
}

return View();\
}


---

Original Source: https://www.mindstick.com/forum/658/overload-views-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
