0

my project with ASP classic get parameter with this code:

protected void Page_Load(object sender, EventArgs e)
{
    RefIdLabel.Text = Request.Params["RefId"];      
}

but in ASP.NET MVC 3 with Httppost method not working to get parameter and display error 404 not found . parameter is null.

[HttpPost]
public ActionResult callbackfrombank()
{
   string RefId = Request.Params["RefId"];
}

why? please help me. thanks ...

  • post parameter from another server to my server.
5
  • And what does your client markup or JS look like? Commented Aug 12, 2014 at 4:04
  • I do not understand what you mean? Commented Aug 12, 2014 at 4:09
  • You post to this action somehow, either using JavaScript or a plain old HTML form. However you are doing this is where the problem likely lies. Commented Aug 12, 2014 at 4:11
  • I do not know how the server post parameter. Commented Aug 12, 2014 at 4:17
  • Can you provide your routing records? MVC and "ASP Classic" are two completely different technologies Commented Aug 12, 2014 at 4:20

2 Answers 2

1

Use FormCollection to pass submitted data

[HttpPost]
public ActionResult callbackfrombank(FormCollection collection)
{
   string RefId = collection["RefId"];
}
Sign up to request clarification or add additional context in comments.

2 Comments

post parameter from another server to my server.
It's much easier to just make it a parameter on the method, i.e. callbackfrombank(string refId). MVC will bind that parameter to any value in the request where it can find it (query string, form variable, etc.).
0

Following code will work for you,

[HttpPost]
public ActionResult callbackfrombank(string refId)
{
   string RefId = refId;
}

4 Comments

when call callbackfrombank action with httppost display error 404 not found.
How do you access the method? to get this, you have to do a POST request via form or JS
try to get parameter from another server. no post paramter.
if no post parameter then it should be get request. if it is get request, remove the [HttpPost] and it will works for you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.