好的,以前有人问过,但那里没有可靠的解决方案.所以为了我自己和其他可能觉得有用的人的目的.
在MVC2(ASP.NET)中我想要它,所以当有人导航到网站时,指定了一个默认区域.因此,导航到我的站点应该会将您发送到AreaZ中的ControllerX ActionY.
在Global.asax中使用以下路由
routes.MapRoute(
"Area",
"",
new { area = "AreaZ", controller = "ControllerX ", action = "ActionY " }
);
Run Code Online (Sandbox Code Playgroud)
现在,这样可以尝试提供正确的页面.但是,MVC继续在站点的根目录中查找View,而不是在Area文件夹中查找.
有办法解决这个问题吗?
编辑
有一个'解决方案',即在ControllerX中,ActionY返回视图的完整路径.一点点黑客但它确实有效.但是我希望有更好的解决方案.
public ActionResult ActionY()
{
return View("~/Areas/AreaZ/views/ActionY.aspx");
}
Run Code Online (Sandbox Code Playgroud)
编辑:
当具有页面的HTML ActionLink时,这也成为一个问题.如果未设置该区域,则"操作链接"输出为空白.
所有这些都是设计还是缺陷?
荫做了PhoneGap的应用程序,当IAM试图type="date"如下图所示输入字段,,它显示在iPhone日期选择器如我所料,但它不显示我所提供的占位符.我在SO中发现了同样的问题,但在任何地方都没有解决方案,希望有人可以帮助我.谢谢.
<input placeholder="Date" class="textbox-n" type="date" id="date">
Run Code Online (Sandbox Code Playgroud) 这应该是一个愚蠢的问题,但我不能为我的生活找到任何解释.
在Nuget中有两个看起来像主包的包:AngularJS Core和Angular JS.前者将AngularJS团队作为作者,就像其他角度模块一样,下载量约为20万.后者有不同的作者Fitzchak Yizcaki,Dov Landau在其他任何地方都看不到,并且包的id与其他包的格式不同,但是下载量约为350k.
现在,通过查看其他包的依赖关系,我们看到它们引用了AngularJS.Core,所以我们现在认为这就是我们想要的.我假设.
但是另一个包是什么,为什么几乎有两倍的下载?
我如何更改WebClient请求的动词?它似乎只允许/默认POST,即使在DownloadString的情况下.
try
{
WebClient client = new WebClient();
client.QueryString.Add("apiKey", TRANSCODE_KEY);
client.QueryString.Add("taskId", taskId);
string response = client.DownloadString(TRANSCODE_URI + "task");
result = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(response);
}
catch (Exception ex )
{
result = null;
error = ex.Message + " " + ex.InnerException;
}
Run Code Online (Sandbox Code Playgroud)
而Fiddler说:
POST http://someservice?apikey=20130701-234126753-X7384&taskId=20130701-234126753-258877330210884 HTTP/1.1
Content-Length: 0
Run Code Online (Sandbox Code Playgroud) 我不得不问,因为这让我发疯.我看到在Google上安装打字的 npm方式,但是Angular2的教程中添加了一个typings.json文件,然后添加了typings文件夹并自动从DefinitelyTyped下载了d.ts文件.我用jquery尝试了这个,但它没有下载.我也尝试重建项目,我希望package.json包含添加其他类型的命令.
这是我的package.json文件中的脚本:
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
}
Run Code Online (Sandbox Code Playgroud)
这是我试过的typings.json文件.es6-shim和jasmine已下载.
{ "ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",
"jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd"
}}
Run Code Online (Sandbox Code Playgroud)
这可能是一些简单的事情,比如在标签之后没有看起来像校验和的东西.我在哪里可以找到正确的校验和,或者我需要在package.json中添加什么命令来检索编译时的输入,或者我做错了什么?
这是另一个向typings.json文件添加一行的示例,然后为您安装d.ts文件.向下滚动,直到看到手动输入
typescript visual-studio-2015 typescript1.8 typescript-typings angular
我有这个CAML:
query.Query = @"<Where><Eq><FieldRef Name='MessageID' /><Value Type='Text'></Value></Eq></Where>";
Run Code Online (Sandbox Code Playgroud)
这将检查MessageID = string.empty()的值
我想检查的是null ....不是空字符串...
这可能与CAML有关吗?
我有自己的Form组件,我想将它与Parent Component.
const Form: React.FC<any> = ({ children, handleFormSubmit }) => (
<form onSubmit={handleFormSubmit}>{children}</form>
);
Run Code Online (Sandbox Code Playgroud)
Parent Component
const ParentComponent = () => {
...
const handleFormSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
publishReview(review).then(() => setReview(initialReviewState));
};
return (
<Form onSubmit={handleFormSubmit}>
...
</Form>
)}
Run Code Online (Sandbox Code Playgroud)
我认为handleFormSubmit会从它的声明中获取类型const handleFormSubmit = (event: React.FormEvent<HTMLFormElement>)。
但它没有
我试图构建一个接口,甚至使用一种any类型:
interface FormProps {
handleFormSubmit: any
}
const Form: React.FC<FormProps>= ({ children, handleFormSubmit }) => (
<form onSubmit={handleFormSubmit}>{children}</form>
);
Run Code Online (Sandbox Code Playgroud)
但它给出了以下错误:
const …Run Code Online (Sandbox Code Playgroud) 为了简化这个问题,我将描述更高级别的问题,然后根据需要进入任何实现细节.
我在开发中的应用程序中使用ASP.NET标识.在一系列请求的特定场景中,UserManager首先获取当前用户(至少一个FindById请求),其中获取用户.在随后的请求中,我更新了UserManager.Update保存的有关此用户的信息,我可以看到数据库中的更改仍然存在.
问题在于,在进一步的后续请求中,从FindById获取的用户对象不会更新.这很奇怪,但可能是UserManager中的缓存,我不明白.但是,当我跟踪数据库调用时,我看到UserManager确实正在将sql-requests发送到数据库以获取用户.
这就是它变得非常奇怪的地方 - 即使确认数据库是最新的,UserManager仍然以某种方式返回此过程中的旧对象.当我自己运行与数据库直接跟踪的完全相同的查询时,我会按预期获得更新的数据.
这个黑魔法是什么?
显然,某些东西被缓存在某个地方,但为什么它会对数据库进行查询,只是忽略它获得的更新数据?
例
下面的示例更新了db中对控制器操作的每个请求的所有内容,当GetUserDummyTestClass在另一个UserManager实例上调用findById时,我可以跟踪sql请求,并可以直接测试这些请求并验证它们是否返回更新的数据.但是,从同一行代码返回的用户对象仍具有旧值(在此方案中,应用程序启动后的第一次编辑,无论调用Test操作的时间长短).
调节器
public ActionResult Test()
{
var userId = User.Identity.GetUserId();
var user = UserManager.FindById(userId);
user.RealName = "name - " + DateTime.Now.ToString("mm:ss:fff");
UserManager.Update(user);
return View((object)userId);
}
Run Code Online (Sandbox Code Playgroud)
Test.cshtml
@model string
@{
var user = GetUserDummyTestClass.GetUser(Model);
}
@user.RealName;
Run Code Online (Sandbox Code Playgroud)
GetUserDummyTestClass
public class GetUserDummyTestClass
{
private static UserManager<ApplicationUser> _userManager;
private static UserManager<ApplicationUser> UserManager
{
get { return _userManager ?? (_userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))); }
}
public static ApplicationUser GetUser(string id)
{
var user = …Run Code Online (Sandbox Code Playgroud) 如何调整图像大小(使用HTML5 canvas元素)并保留原始图像中的EXIF信息?我可以从原始图像中提取EXIF信息,但我不知道如何将其复制到已调整大小的图像.
这是我检索调整大小的图像数据以发送到服务器端代码的方法:
canvas.toDataURL("image/jpeg", 0.7);
Run Code Online (Sandbox Code Playgroud)
对于EXIF检索,我使用的是exif.js库.
c# ×3
html5 ×2
javascript ×2
typescript ×2
angular ×1
angularjs ×1
asp.net ×1
asp.net-mvc ×1
assemblies ×1
cordova ×1
datepicker ×1
exif ×1
http-get ×1
placeholder ×1
reactjs ×1
sharepoint ×1
strongname ×1
webclient ×1