网址编码不起作用 [英] Url encoding does not work

查看:117
本文介绍了网址编码不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在页面加载时编码我的网址。它必须以页面加载时始终对页面进行编码的方式工作。但它不起作用,这个页面是一个独立的页面,所以没有链接重定向用户,但我需要让它为我的项目工作。



请帮助谢谢!



这是我的Page_Load代码

Hi, I wanted to encode my url on page load. It has to work in a way that the page will always be encoded on page load. But it is not working, this page is a standalone page so there are no link to redirect user but I need to get it working for my project.

Please help thanks!

This is my Page_Load code

protected void Page_Load(object sender, EventArgs e)
  {
      string destinationURL = "http://localhost:2094/PaymentSuccesful";

      string encodeURL = Server.UrlEncode(destinationURL);

      Response.Redirect(encodeURL);
  }

推荐答案

您拥有的网址不需要编码。请注意,URL编码与加密无关 - 它编码特殊字符以正确传递http流量。我有一种感觉,你想要别的东西。页面本身无法编码。重定向发生在客户端基于http头字段,无法加密。



所以你想要的是无法实现,或者你必须重新提出你的问题 - 请注意在你的情况下使用加密,记住加密和编码是两回事。
The url you have does not need encoding. Please note that URL encoding has nothing to do with encryption - it encodes special characters to pass http traffic correctly. I have a feeling, that you want something else. A page itself can't be encoded. Redirection happens on client side based on a http header field, which can't be encrypted.

So what you want either can't be achieved, or you have to reformulate your question - please emphasize the use of encryption in your case keeping in mind that encryption and encoding are two different things.


这篇关于网址编码不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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