---
title: "How to use multiple action verb in mvc4"  
description: "How to use multiple action verb in mvc4"  
author: "Manish Kumar"  
published: 2017-03-22  
updated: 2017-03-22  
canonical: https://www.mindstick.com/forum/34278/how-to-use-multiple-action-verb-in-mvc4  
category: "c#"  
tags: ["mvc4"]  
reading_time: 2 minutes  

---

# How to use multiple action verb in mvc4

How to use [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) action verb in [mvc](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc) I don’t want to make get [action method](https://www.mindstick.com/forum/160300/how-to-pass-data-to-an-httppost-action-method-in-a-dot-net-core-api) , I want to use get and [post](https://www.mindstick.com/articles/12829/aspects-that-make-australia-post-shipping-extension-a-useful-tool) action verb in same action method and how we can know which action verb is called at current time

This is my [sample](https://www.mindstick.com/news/2174/mars-mission-by-nasa-prepares-for-tests) [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)

Please [anyone help me](https://www.mindstick.com/forum/331/can-anyone-help-me-out-how-to-use-session-concept),

```
      public ActionResult image()        {            return View();        }       [HttpPost]        public ActionResult Image(HttpPostedFileBase file)        {            if (file != null)                try                {                    // extract only the fielname                    var fileName = Path.GetFileName(file.FileName);                    // store the file inside ~/Images folder                    var path = Path.Combine(Server.MapPath("~/Images/file"), fileName);                    file.SaveAs(path);                                       ViewBag.Message = "File uploaded successfully";                }                catch (Exception ex)                {                    ViewBag.Message = "ERROR:" + ex.Message.ToString();                }            else            {                ViewBag.Message = "You have not specified a file.";            }            return View();                   }
```

Thank you.

## Replies

### Reply by Manoj Bhatt

Hi Manish you can also apply multiple http verbs using AcceptVerbs attribute. GetAndPostAction [method](https://www.mindstick.com/forum/166/webservice-method) supports both, GET and POST ActionVerbs in the following example:

\

```
  [AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get)]                public ActionResult Image(HttpPostedFileBase file)        {            if (file != null)                try                {                    // extract only the fielname                    var fileName = Path.GetFileName(file.FileName);                    // store the file inside ~/Images folder                    var path = Path.Combine(Server.MapPath("~/Images/file"), fileName);                    file.SaveAs(path);                                       ViewBag.Message = "File uploaded successfully";                }                catch (Exception ex)                {                    ViewBag.Message = "ERROR:" + ex.Message.ToString();                }            else            {                ViewBag.Message = "You have not specified a file.";            }            return View();                   }
```


---

Original Source: https://www.mindstick.com/forum/34278/how-to-use-multiple-action-verb-in-mvc4

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
