所以我有一个带有标题,主体和页脚的网页.我希望主体填充页面的100%(在页脚和页眉之间填充100%)我的页脚是绝对位置底部:0.每次我尝试将主体设置为100%高度或更改位置或其他东西它也将溢出标题.如果将body设置为绝对位置top: 40
(因为我的标题是40px高),它将向下移动40px太远,创建一个滚动条.
我创建了一个简单的html文件,因为我实际上无法从实际项目中发布整个页面/ css.使用示例代码,即使主内容体填满屏幕,它也会向下移动40px(因为我认为是标题).
html,
body {
margin: 0;
padding: 0;
}
header {
height: 40px;
width: 100%;
background-color: blue;
}
#maincontent {
background-color: green;
height: 100%;
width: 100%;
}
footer {
height: 40px;
width: 100%;
background-color: grey;
position: absolute;
bottom: 0;
}
Run Code Online (Sandbox Code Playgroud)
HTML
<html>
<head>
<title>test</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header></header>
<div id="maincontent">
</div>
<footer></footer>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
谁知道答案?
我正在将项目从ASP.NET RC1迁移到ASP.NET Core 1.0.
我有一个允许用户上传一个或多个文件的视图,我使用Jquery Ajax发布.我还在同一篇文章中序列化并发布了一些设置.
以下都在RC1(和pre-asp.net核心)中工作:
JS:
$('#submit').click(function () {
var postData = $('#fields :input').serializeArray();
var fileSelect = document.getElementById('file-select');
var files = fileSelect.files;
var data = new FormData();
for (var i = 0; i < files.length; i++) {
data.append('file' + i, files[i]);
}
$.each(postData, function (key, input) {
data.append(input.name, input.value);
});
var url = '/ajax/uploadfile';
$.ajax({
url: url,
type: "POST",
contentType: false,
processData: false,
cache: false,
data: data,
success: function (result) {
alert('success');
},
error: function () {
alert('error'); …
Run Code Online (Sandbox Code Playgroud) 我想自动化我的Azure资源管理,我正在使用ARM模板这样做.
如果我想从我的C#代码(下载Azure导出模板时生成的DeploymentHelper.cs)连接到Azure.
该代码要求提供以下详细信息:
string subscriptionId = "your-subscription-id";
string clientId = "your-service-principal-clientId";
string clientSecret = "your-service-principal-client-secret";
string resourceGroupName = "resource-group-name";
string deploymentName = "deployment-name";
string resourceGroupLocation = "resource-group-location"; // must be specified for creating a new resource group
string pathToTemplateFile = "path-to-template.json-on-disk";
string pathToParameterFile = "path-to-parameters.json-on-disk";
string tenantId = "tenant-id";
Run Code Online (Sandbox Code Playgroud)
我可以通过powershell看到tentantId和subscriptionId,但我不知道如何获取clientId和clientsecret,我也找不到任何关于如何获取这些内容的可靠指令.
简单的问题,如果你有一个只有一个属性的类,以及许多(非静态)方法,每次你说'new object()'或者只是属性和方法时,都会存储一个全新的对象在一些'共同'的内存空间中,所以同一类型可以引用它?
因此,在实例化时间方面,是否有一个大类总是比一个小类更差?
考虑Azure云服务被认为是"经典",MS正在转向使用资源管理器.
托管WCF Web服务的建议路径是什么?我曾经使用Azure云服务执行此操作,因此我不必管理虚拟机,但我无法找到云服务的明显后继者.
我有一个非常基本的asp.net MVC 6应用程序与基本路由,我有一个自定义ErrorController将错误路由到某些视图.
但我希望当用户键入不存在的URL时,会抛出异常(我可以处理它).但是,当我输入一些随机URL时,不会抛出任何异常,我只是得到一个空白页面.我很确定这在MVC <6中同样有效.
如果我只是在控制器中抛出异常,错误处理本身工作正常.
Startup.cs(部分)
public void Configure(IApplicationEnvironment appEnv, IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler(HandleException);
}
app.UseStaticFiles();
app.UseMvc(routes => MapRoutes(routes, appEnv));
}
private static void MapRoutes(IRouteBuilder routes, IApplicationEnvironment env)
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}/{id?}",
defaults: new { controller = "main", action = "index" });
}
private static void HandleException(IApplicationBuilder errorApp)
{
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
errorApp.Run(async context => HandleErrorContext(context)); …
Run Code Online (Sandbox Code Playgroud) 我正在使用单独的数据库多租户架构构建MVC4应用程序.客户还可以选择上传文件(大多数为1-5MB,文本文件/文档).
我得出结论,最好将文件存储在文件系统中,同时将元数据保存在数据库中(每个客户的单独文件夹),但是,我不知道存储文件的位置.MVC是否有特殊的位置?或者我应该在服务器上的某个地方创建一个文件夹.
并且默认情况下创建这样的文件夹安全吗?
谢谢!
我有几个MVC6(asp.net 5)项目的解决方案.每个项目都使用bower和npm作为包.Bower安装了normalize-css和jquery.
在我开始解决方案的10次中,有9次会在mvc项目的初始化阶段中崩溃.如果我调试我得到以下错误.
An unhandled exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in mscorlib.dll
Additional information: Unexpected end when deserializing object. Path 'dependencies.jquery.pkgMeta.devDependencies', line 43, position 1.
Run Code Online (Sandbox Code Playgroud)
如果我从bower依赖项中删除jquery并且只剩下normalize-css,我得到:
An unhandled exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in mscorlib.dll
Additional information: Unexpected end when deserializing object. Path 'dependencies.normalize-css.pkgMeta._release', line 39, position 1.
Run Code Online (Sandbox Code Playgroud)
我已经卸载了所有的bower软件包并且问题已修复,但我显然仍然需要软件包,所以当再次添加jquery或其他软件包时,崩溃再次开始.
我正在使用Visual Studio 2015 Enterprise.
编辑bower.json:
{
"name": "ASP.NET",
"private": true,
"dependencies": {
"jquery": "2.1.4",
"normalize-css": "3.0.3"
}
}
Run Code Online (Sandbox Code Playgroud) 当我使用ASP.NET Core 1.0创建默认的演示Web项目时,它使用global.json中的dnx-clr-win-x86.1.0.0-preview2-003121运行时.
Visual Studio 2015将要求我下载此运行时因为我没有安装它,但是在DNVM输出窗口中我收到以下错误:
There are no runtimes matching the name dnx-clr-win-x86 on feed https://www.nug
et.org/api/v2.
At C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1:619 char:9
+ throw "There are no runtimes matching the name $RuntimeId on ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (There are no ru...get.org/api
/v2.:String) [], RuntimeException
+ FullyQualifiedErrorId : There are no runtimes matching the name dnx-clr-
win-x86 on feed https://www.nuget.org/api/v2.
There are no runtimes matching the name dnx-clr-win-x86 on feed https://www.myg
et.org/F/aspnetvnext/api/v2.
At C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1:619 char:9 …
Run Code Online (Sandbox Code Playgroud) 我在解决方案X中有一个ASP.NET Core 1.0 MVC应用程序,我在解决方案Y中有一些常见项目(.net 4.5.2类库).
我想从我的应用程序中引用解决方案Y中的项目,当我这样做时通过添加引用 - >浏览..我得到:
.NET Core projects only support referencing .NET framework assemblies in
this release. To reference other assemblies,
they need to be included in a NuGet package and reference that package.
Run Code Online (Sandbox Code Playgroud)
然后我创建了这些项目的nuget包,添加了包含nuget包作为repo源的文件夹并加载了项目.这会将项目成功添加到我的project.json中,但实际上"没有"实际发生,我仍然无法在我的应用程序中使用该代码.
现在ASP.NET Core已经过了beta版状态,处理这个问题的官方方式是什么?
asp.net asp.net-mvc visual-studio asp.net-core-mvc asp.net-core
我在IIS 8.5的不同虚拟目录中有一些应用程序,其路径如下:
http://sub.domain.com/logicalgroup/applicationname
如何将请求重定向到HTTPS?如果没有道德,我就会一切正常。目录,但有1个额外的文件夹,我无法使其工作。
谢谢!
我有一个场景,我在Windows Azure中有一个Windows VM需要连接到外部客户网络(并连接到不在Azure中的数据库).
这种流量是单向的,因为只有我的VM需要连接到客户的数据库,而不是相反.站点到站点在Azure上管理,我无法在本地测试.
从概念上讲,通过点对点VPN连接到客户的网络似乎更合适(通过网络配置在Windows中创建VPN连接).
客户更喜欢站点到站点,即使他们不需要连接到我的VM.我错过了什么吗?
我有一个网站,我只想与https://www-prefix 一起使用。我必须在我的 web.config(Azure 网站上的 asp.net MVC)中配置 2 个 url 重定向,一个从 http 到 https,一个从裸域到 www.domain。
我最初只为我的 www.domain.com 购买了 SSL 证书,但是当有人进入裸域时,他会在重定向发生之前收到浏览器警告/阻止。最终我买了第二个 SSL 证书。对于我的裸域,现在一切正常,但我不禁怀疑,我真的需要为这种情况购买 2 个证书吗?