zoukankan      html  css  js  c++  java
  • Request.Url

    Uri 方法獲取 Protocal Host Port

    			Uri uri = new Uri("https://www.mywebsite.com:80/pages/page1.aspx");
    			string requested =$"{uri.Scheme}   {Uri.SchemeDelimiter}    { uri.Host}    { uri.Port}   {uri.AbsolutePath}";
    			Console.WriteLine(requested);
    			// 【uri.Scheme/Request.Url.Scheme】   https 
    			// 【Uri.SchemeDelimiter/Request.Url.SchemeDelimiter】   ://  
    			// 【uri.Host/Request.Url.Host】  www.mywebsite.com 
    			// 【uri.Port/Request.Url.Port】  80
    			// 【Request.Url.AbsolutePath】   /pages/page1.aspx
    
    
    			string aut = UriPartial.Authority.ToString();
    			Console.WriteLine(aut);
    
    			string authority = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);			
    			Console.WriteLine(authority);
    			// 【Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)】 https://www.mywebsite.com:80  可以灵活选择所需元素
    
    			string requested2 = $"{uri.GetLeftPart(UriPartial.Authority)}";
    			Console.WriteLine(requested2);
    			//【uri.GetLeftPart(UriPartial.Authority)】 https://www.mywebsite.com:80
    

      

  • 相关阅读:
    shell lab
    cache lab
    后缀树
    leetcode maximum-length-of-repeated-subarray/submissions
    leetcode assign-cookies
    lcs
    leetcode delete-operation-for-two-strings
    【C】C语言typedef
    【C】C语言结构体指针的语法
    【JAVA】Java 命令行参数解析
  • 原文地址:https://www.cnblogs.com/dennysong/p/10082917.html
Copyright © 2011-2022 走看看