将数据从iPhone发布到ASP.NET

时间:2013-02-07 13:04:12

标签: iphone ios

我成功测试了这段代码,但它只适用于PHP,如果我把ASP的名称放在TextBox中,它就不起作用了。我很高兴为ASP.NET提供任何帮助

    if (![nameInput.text isEqual: @""] && ![passInput.text isEqual: @""])
{
    NSString *postString = [NSString stringWithFormat:@"name0=%@&name1=%@", nameInput.text, passInput.text];
    NSData *data = [postString dataUsingEncoding:NSASCIIStringEncoding];

    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.ucimsewebu.eu/info.php"]];
    [request setHTTPMethod:@"POST"];
    [request setHTTPBody:data];

    [webView loadRequest:request];
}

这是ASP TextBox代码

 <tr>
                    <td>
                        <span id="cphmain_LabelJmeno">Přihlašovací jméno:</span></td>
                    <td>
                        <input name="ctl00$cphmain$TextBoxjmeno" type="text" id="cphmain_TextBoxjmeno" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <span id="cphmain_LabelHeslo">Heslo:</span></td>
                    <td>
                        <input name="ctl00$cphmain$TextBoxHeslo" type="password" id="cphmain_TextBoxHeslo" title="heslo" />
                    </td>
                </tr>
                <tr>

1 个答案:

答案 0 :(得分:1)

您可以遍历请求集合

For Each Item In Request.Form
 Response.Write Item & ": " & Request.Form(Item) & "<br>"
Next