【问题标题】:Access url in windows mobile 6 [closed]windows mobile 6中的访问url [关闭]
【发布时间】:2013-06-27 16:29:53
【问题描述】:

我需要通过位于 localhost 的 php 文件传递​​一些值。我需要通过 windows mobile 6 应用程序打开该 url。请建议我一个简单的方法来做到这一点。 网址类似于:

http://localhost/wlchr/index.php?data=Pharmacy&num=1

问候。

附言

我尝试了连接管理器,但它给出了错误; "当前上下文中不存在名称 'ConnMgrMapURL'"

【问题讨论】:

  • 那么,你有什么尝试?
  • 我试过连接管理器,但它给出了错误; “当前上下文中不存在名称‘ConnMgrMapURL’”
  • 什么连接管理器?连接到 URL 的 C# 代码在哪里?
  • @RowlandShaw 请参考上面的链接并通知我任何错误。问候。

标签: c# .net windows-mobile visual-studio-2005 windows-mobile-6.5


【解决方案1】:

首先,为了能够响应 localhost 请求,您必须实现一个 Web 服务器。

其次,您的 Web 服务器必须实现 URL 解析以拆分 URL 和参数。

这是一个示例http://www.hjgode.de/wp/2012/10/19/windows-mobile-a-simple-web-server-with-extended-features/,但您并没有真正描述您的使用意图

http://localhost/wlchr/index.php?data=Pharmacy&num=1

我不知道上面的文章是否符合你的需要。

第三:ConnMgrMapURL 不是任何标准 Compact Framework 运行时的一部分。在 MSDN http://msdn.microsoft.com/en-us/library/bb840031.aspx 中描述了 C# 的本机 ConnMgr API 的实现。

进一步阅读 ConnMgr http://www.codeproject.com/Articles/98020/Using-the-Connection-Manager

【讨论】:

    【解决方案2】:

    我已经通过使用 HttpWebRequest 方法解决了我的问题。

    using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Text;
    using System.Net;
    using System.IO;
    
    namespace wlchrUrl
    {
        class urlConn
        {
            public void DoConnect(string url)
            {
               Uri uri = new Uri(url);
            try
            {
                HttpWebRequest httpRequest = (HttpWebRequest)HttpWebRequest.Create(uri);
                HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
                Stream stream= httpResponse.GetResponseStream();
    
                httpResponse.Close();
                stream.Close();
    
            }
            catch(Exception ex)
            {
                throw ex;
            }
    
        }
    }
    

    }

    【讨论】:

      猜你喜欢
      • 2012-12-17
      • 2012-06-03
      • 1970-01-01
      • 2011-09-20
      • 2011-12-07
      • 2014-12-04
      • 1970-01-01
      • 1970-01-01
      • 2010-12-11
      相关资源
      最近更新 更多