我如何连接code的网址是什么? [英] How do I encode an URL?

查看:95
本文介绍了我如何连接code的网址是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我跑我的项目,我获得url 的http://本地主机:5973 / PageToPageValuePass / Default.aspx的我想恩code中的网址,因为有时我需要将数据从页传输到页面。当URL是EN codeD,然后它增加了可靠性。

When I run my project I get the url http://localhost:5973/PageToPageValuePass/Default.aspx I want to Encode the URL since sometimes I need to transfer data from page to page. When the urls are encoded then it increases the reliability.

Server.UrlEncode("http://www.google.com/c#");

我得到这个,但我怎么用它来帮我带code中的网址是什么?

I get this, but how do I use it to help me encode the url?

推荐答案

如果路径中的编码部分组成:

If your encoding parts of the path:

System.Uri.EscapeUriString("c#")

如果您编码'参数':

String.Format( "http://something/?test={0}", System.Uri.EscapeDataString("c#") );

这篇关于我如何连接code的网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆