Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- STS
- 이클립스
- asp.net
- javascript
- scrollView
- TextBox
- Web Service
- 안드로이드
- 컬럼명
- Maven
- 웹 서비스
- 웹뷰
- Bootstrap
- varags
- Eclipse
- Android
- WebView
- Apache Lucene
- SpringSource Tool Suite
- html
- 자바
- Java
- 자바스크립트
- MSsql
- decompiler
- MS-SQL
- Redirect
- jsp
- C#
- MANTIS
Archives
- Today
- Total
bboks.net™
ASP.NET Code Behind에서 Post로 값 넘기기 본문
일반적으로 aspx에서 form 태그를 써서 값을 넘겨도 되지만 부득이하게 코드비하인드에서 POST로 값을 넘겨야 할 경우가 발생한다.
아래의 코드를 이용하면 한방에 해결
private void submitForm(string url, string mallId, string mallNo, string orderNo)
{
System.Web.HttpContext.Current.Response.Write("<form name='newForm' method=post action='" + url + "'>");
{
System.Web.HttpContext.Current.Response.Write("<form name='newForm' method=post action='" + url + "'>");
System.Web.HttpContext.Current.Response.Write(string.Format("<input
type=hidden name=\"mallId\" value=\"{0}\">", mallId));
System.Web.HttpContext.Current.Response.Write(string.Format("<input
type=hidden name=\"mallNo\" value=\"{0}\">", mallNo));
System.Web.HttpContext.Current.Response.Write(string.Format("<input
type=hidden name=\"orderNo\" value=\"{0}\">", orderNo));
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body>");
Response.Write("<SCRIPT LANGUAGE='JavaScript'>document.forms[0].submit();</SCRIPT>");System.Web.HttpContext.Current.Response.Write("</body>");
}
[출처] POST through code behind in asp.net