创建 Web 项目时,Visual Studio 会自动生成 SSL 证书并提示您安装它。一切正常。
该证书现已过期,我不知道如何让它重新生成证书并重新开始该过程。我尝试localhost从证书存储中删除所有现有证书并删除 Secrets.json,但似乎没有什么可以强制它重新启动生成过程。
asp.net ssl-certificate visual-studio .net-core asp.net-core
我正在使用ASP.NET WebApi并使用以下代码来阻止所有内容中的缓存:
public override System.Threading.Tasks.Task<HttpResponseMessage> ExecuteAsync(System.Web.Http.Controllers.HttpControllerContext controllerContext, System.Threading.CancellationToken cancellationToken)
{
System.Threading.Tasks.Task<HttpResponseMessage> task = base.ExecuteAsync(controllerContext, cancellationToken);
task.GetAwaiter().OnCompleted(() =>
{
task.Result.Headers.CacheControl = new CacheControlHeaderValue()
{
NoCache = true,
NoStore = true,
MaxAge = new TimeSpan(0),
MustRevalidate = true
};
task.Result.Headers.Pragma.Add(new NameValueHeaderValue("no-cache"));
task.Result.Content.Headers.Expires = DateTimeOffset.MinValue;
});
return task;
}
Run Code Online (Sandbox Code Playgroud)
结果标题看起来像这样(chrome):
Cache-Control:no-store, must-revalidate, no-cache, max-age=0
Content-Length:1891
Content-Type:application/json; charset=utf-8
Date:Fri, 19 Jul 2013 20:40:23 GMT
Expires:Mon, 01 Jan 0001 00:00:00 GMT
Pragma:no-cache
Server:Microsoft-IIS/8.0
Run Code Online (Sandbox Code Playgroud)
在阅读了有关错误(如何阻止缓存中的chrome)之后,我添加了"no-store" .
但是,无论我做什么,当我做一些导航我远离此页面的东西,然后使用"后退"按钮时,chrome总是从缓存中加载:
Request Method:GET
Status Code:200 OK (from cache) …Run Code Online (Sandbox Code Playgroud) 我有一个div,我做了一个 $('#div').css('display', 'none');
现在,为了把这个项目带回来,我想淡入它.但是,它似乎$('#div').fadeIn()没有这样做,但我不想将显示设置回阻止,好像我这样做只是立即重新出现而不是褪色..任何想法?
我目前正在创建一个.NET C#API.我有很多课程,其中一些课程必须通过REST服务转移JSON.例如,我可能有一个包含大量业务元数据的帐户对象:
public class Account
{
public ComplicatedClass SomeProperty { get; set; }
public string SomeOtherProperty { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
有很多类,还有更多嵌套的类(如ComplicatedClasstype属性所示).为了避免淹没这个业务对象[DataMember]等.将使这个类变得混乱的属性,我想做一个DTOfor JSON:
public class AccountDTOForJSON
{
[DataMember(Name="someProperty")]
public ComplicatedClassDTOForJson SomeProperty { get; set; }
[DataMember(Name="someOtherProperty")]
public string SomeOtherProperty { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,似乎没有任何工具(我可以找到)自动生成这些DataContract类,并且还提供来回传递属性的代码.
当然,我可以手动完成所有这些工作(最坏的情况),或者滚动我自己的工具来生成/映射(第二个更坏的情况).但是,我想首先知道是否已经有一种工具来做这种事我可以用来节省自己的时间.
我目前正在编写API代码,其中包含多个层,包含$ .ajax()调用.
一个要求是用户必须能够取消任何请求(例如,如果它花费的时间太长).
通常这可以通过简单的方式实现,例如:
var jqXHR = $.ajax(..);
$(mycancelitem).click(function () {
jqXHR.abort();
});
Run Code Online (Sandbox Code Playgroud)
但是我的代码看起来更像是这样的:
function myapicall() {
var jqxhr = $.ajax(…);
var prms = def.then(function (result) {
// modify the result here
return result + 5;
});
return prms;
}
Run Code Online (Sandbox Code Playgroud)
这里的问题是有人调用myapicall()只获取jQuery.Promise而无法中止它.虽然上面的示例非常简单,但在我的实际代码中,在许多地方有几层链接.
这个问题有方法解决吗?
我有一个MySQL 5.0服务器,我正在运行此查询:
SELECT *
FROM deals
WHERE expires > "2012-05-25 19:37:58"
AND city =2
ORDER BY UIN
LIMIT 48 , 57
Run Code Online (Sandbox Code Playgroud)
它正在回归:
显示0到29行(共57行,查询耗时0.0036秒)
难道我做错了什么?我期待9行,48-57 ..
所以我很清楚,一般来说,应该在JS与浏览器检测中使用特征检测.这被推一个很好的例子是jQuery 1.9的的下降$.browser.
另外,在我读过的每篇文章中,它都表示从不使用浏览器检测.
但是我有,我需要动态计算条件#的"slots"可在一个JS布局,它正在通过做calc(100%/{0}),这里{0}是#插槽可用.
当然,在iPad中,它.css("height", "calc(100%/3)")会失败,因为它必须带有前缀-webkit-.
那么,任何人都可以告诉我我应该如何使用特征检测(而不是旧特征$.browser.webkit)来检测它是否需要这个?
我对我的应用程序有以下要求:在JavaScript(客户端)和服务器(ASP.NET)之间打开连接.此连接必须能够在中等时间内来回发送数据并保持有状态(与REST调用不同),直到它关闭.也就是说,对于连接的持续时间,客户端基本上具有与服务器的亲和性(在web场方案中).
我已经阅读了很多关于SignalR和WebSockets的内容,但我无法弄清楚这是不是它的运作方式.
我不关心web-farm中服务器之间的服务器 - >服务器通信,因为这已经通过代码解决了.我只需要JS客户端和它最初联系的服务器在连接期间保持联系.
它是如何工作的,如果没有,这可能吗?此外,如果可能,如何在多个呼叫/广播的连接期间将信息存储在内存中?
我在这里创建了一个JSFiddle问题
这适用于Firefox v33和v33.1,但是在34-35中失败了.这适用于Chrome和IE11.它可能是Firefox中的一个错误,但我不确定.基本上我有HTML看起来像这样:
.container {
position: absolute;
width: 150px;
}
.innercontainer {
position: relative;
padding-right: 25px;
margin-bottom: 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.outerwrapper {
display: block;
height: 24px;
text-align: center;
font-size: 10px;
line-height: 24px;
margin-bottom: 5px;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
box-orient: horizontal;
-webkit-box-orient: horizontal;
flex-direction: normal;
-ms-flex-direction: normal;
-moz-flex-direction: normal;
-webkit-flex-direction: normal;
}
.wrapper {
flex: 1;
-ms-flex: 1 0 auto;
-moz-flex: 1;
-webkit-flex: 1;
-webkit-box-flex: 1;
display: -webkit-box; …Run Code Online (Sandbox Code Playgroud)我为我的应用程序创建了另一个主题,即Dark.我使用导航栏定义为
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
Run Code Online (Sandbox Code Playgroud)
它在菜单中定义了两组可选择的组
<item
android:id="@+id/sort_item"
android:title="One">
<menu>
<group
android:id="@+id/menu_group_sort"
android:checkableBehavior="single">
<item
android:id="@+id/nav_sort_new"
android:title="@string/menu_new" />
<item
android:id="@+id/nav_sort_hot"
android:title="@string/menu_hot" />
<item
android:id="@+id/nav_sort_top"
android:title="@string/menu_top" />
</group>
</menu>
</item>
<item
android:id="@+id/filter_item"
android:title="Two">
<menu>
<group
android:id="@+id/menu_group_filter"
android:checkableBehavior="single">
<item
android:id="@+id/nav_category_all"
android:title="@string/menu_all" />
<item
android:id="@+id/nav_category_business"
android:title="@string/menu_business" />
<item
android:id="@+id/nav_category_technology"
android:title="@string/menu_technology" />
<item
android:id="@+id/nav_category_politics"
android:title="@string/menu_politics" />
</group>
</menu>
</item>
Run Code Online (Sandbox Code Playgroud)
通常,所选项目的文本是colorPrimary,背景看起来是某种Android灰色.当我定义我的新主题时,我会这样使用它
<!-- Dark theme. -->
<style name="AppTheme.Dark" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimaryInverse</item>
<item name="colorPrimaryDark">@color/colorPrimaryDarkInverse</item>
<item name="colorAccent">@color/colorAccentInverse</item>
<item name="android:textColor">@color/textColorPrimaryInverse</item>
<item name="android:textColorPrimary">@color/textColorPrimaryInverse</item>
<item name="android:textColorSecondary">@color/textColorSecondaryInverse</item>
<item …Run Code Online (Sandbox Code Playgroud)