小编Hub*_*y03的帖子

ASP.NET Core将http重定向到https

我在web.config中创建了一个重定向规则,将我的网站从http重定向到https.我遇到的问题是网站上的每个链接现在都是https.我有很多链接到其他网站没有SSL,因此我得到证书错误.这就是我所做的:

  <rewrite>
  <rules>
    <rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAny">
        <add input="{SERVER_PORT_SECURE}" pattern="^0$" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)

我如何仅为我的域重定向https而不是我的网站上的每个链接?

asp.net asp.net-mvc ssl redirect asp.net-core

13
推荐指数
3
解决办法
1万
查看次数

Xamarin表示iOS状态栏文本颜色

我无法将我的Xamarin Forms iOS应用的状态栏文本颜色更改为白色.我在info.plist中的更改如下:

<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
Run Code Online (Sandbox Code Playgroud)

然而,颜色仍然是黑色..还有另一种方法来改变状态栏文字颜色?

xamarin.ios ios xamarin xamarin.forms

13
推荐指数
1
解决办法
9786
查看次数

Chrome 地址栏在移动网站上留下空白

我的移动网站上的 Google Chrome 地址栏出现问题。我的网站上有一个固定的导航栏,目前我向下滚动并且地址栏消失,当我打开菜单时,底部出现一个空白(地址栏的大小),我需要向上滚动才能使地址栏出现,从而消除了空白。这是我的菜单 CSS:

#menu {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  z-index: 10000;
  padding: 0;
  background-color: blue;
  overflow-x: hidden;
  overflow-y: auto; 
}
Run Code Online (Sandbox Code Playgroud)

其他网络浏览器在移动设备上运行良好,我该怎么做才能摆脱地址栏空白?

html javascript css jquery google-chrome

5
推荐指数
1
解决办法
5507
查看次数

列出所有容器和blob

我正在使用容器和blob处理Azure Local Development Storage.我希望能够在列表框中显示我的所有容器和blob,就像我的本地开发存储的树视图一样.这是我的代码:

public List<string> ListContainer()
    {
        List<string> blobs = new List<string>();

        // Retrieve storage account from connection string.
        CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
            CloudConfigurationManager.GetSetting("AzureStorageConnectionString"));

        // Create the blob client.
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

        //Get the list of the blob from the above container

        IEnumerable<CloudBlobContainer> containers = blobClient.ListContainers();

        foreach (CloudBlobContainer item in containers)
        {
            blobs.Add(string.Format("{0}", item.Uri.Segments[2]));
        }

        return blobs;
    }
Run Code Online (Sandbox Code Playgroud)

我在这里展示我的所有容器.我需要显示每个容器的所有blob,以及子文件夹.

.net c# azure visual-studio azure-storage-blobs

4
推荐指数
1
解决办法
6418
查看次数

ASP.NET Core URL重写

我试图在中间件中将我的网站从www重定向到非www规则,以及将http重定向到https(https://example.com)。我曾经在web.config中进行那些重定向更改,例如:

 <rewrite>
  <rules>
    <clear />
    <rule name="Redirect to https" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
    </rule>
    <rule name="Redirects to www.domain.com" patternSyntax="ECMAScript" 
            stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_HOST}" pattern="^example.com$" />
        </conditions>
        <action type="Redirect" url="https://www.example.com/{R:0}" />
    </rule>
Run Code Online (Sandbox Code Playgroud)

我是asp.net核心的新手,想知道如何在中间件中进行这些重定向?我读了这篇文章:https : //docs.microsoft.com/zh-cn/aspnet/core/fundamentals/url-rewriting,但这没有帮助我强制将www重定向到非www。

asp.net iis http url-rewriting asp.net-core

4
推荐指数
1
解决办法
2387
查看次数

Xamarin Forms Android透明状态栏

我已经创建了Xamarin Forms项目,但无法将Android状态栏颜色更改为透明。我正在MainActivity的OnCreate()方法中以编程方式更改颜色,如下所示:

  if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
        {
            Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
            Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
            Window.SetStatusBarColor(Color.Transparent);
        }
Run Code Online (Sandbox Code Playgroud)

我尝试了不同的颜色,但效果很好,但是“透明”根本不起作用。我正在对API 22进行测试。

我的style.xml如下:

  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/blue</item>
    <item name="colorPrimaryDark">@color/blue</item>
    <item name="colorAccent">#FF4081</item>
    <item name="windowActionModeOverlay">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
Run Code Online (Sandbox Code Playgroud)

例如,如果我以编程方式将我的颜色设置为Purple,它将正常工作,但是如果将其设置为Transparent,我将得到蓝色的style.xml颜色。如果删除style.xml ColorPrimaryDark颜色,则会显示灰色状态栏。有什么解决方案?

android xamarin.android xamarin xamarin.forms

4
推荐指数
1
解决办法
3045
查看次数

带有透明状态栏的 Xamarin Forms 背景图像

我一直在尝试在 Xamarin Forms 中创建以下布局,即带有透明状态栏的背景图像:

带有透明状态栏的图像

我想要一个带有透明状态栏的背景图像,如上图所示。我的问题是:

  1. 我在 Android 上无法做到这一点,但在 iOS 上却很好。我尝试将状态栏设置为透明并以编程方式进行,似乎我的图像没有位于状态栏后面。我没有在互联网上找到任何相关信息,只是更改了我做了但不起作用的应用程序主题信息。

  2. 在 iOS 上,状态栏文本颜色为黑色,并且无法将其更改为白色。

我花了两周时间试图找出如何做到这一点,但仍然无法做到。我应该为此创建一个自定义渲染器吗?或者有更简单的方法吗?

c# xaml xamarin xamarin.forms

1
推荐指数
1
解决办法
3693
查看次数