asp.net-mvc-2

How to call function on timer ASP.NET MVC

流过昼夜 提交于 2019-11-28 15:40:42
I need to call function on timer (lets say onTickTack() function) and reload some info in ASP.NET MVC project. I know that there are several ways to do that, but which one is the best by your opinion? Note: the function should be called from one place only, and should be called every X mins till application is up. EDIT 1: Reload some info - for example I have something in the Cache and I want to update it from DB on timer - once a day in certain time. The answer to this question would very much depend on what do you mean by reload some info in ASP.NET MVC project . This is not a clearly stated

Facing issue while trying to Comment on a Post Facebook in MVC3

故事扮演 提交于 2019-11-28 14:05:53
问题 I am trying to send the reply to a Facebook Post. Below is my action method public ActionResult GetMyDetails() { var fb = new Facebook.FacebookClient("appId", "appSecret"); dynamic obj = fb.Post( "https://facebook.com/ PostID/ comments/?message=ws&access_token=" + fb.AccessToken ); } Query - I basically want to know, why A comment on Post using the above code is not working ? 来源: https://stackoverflow.com/questions/15740168/facing-issue-while-trying-to-comment-on-a-post-facebook-in-mvc3

Unable to set membernames from custom validation attribute in MVC2

 ̄綄美尐妖づ 提交于 2019-11-28 13:27:18
I have created a custom validation attribute by subclassing ValidationAttribute. The attribute is applied to my viewmodel at the class level as it needs to validate more than one property. I am overriding protected override ValidationResult IsValid(object value, ValidationContext validationContext) and returning: new ValidationResult("Always Fail", new List<string> { "DateOfBirth" }); in all cases where DateOfBirth is one of the properties on my view model. When I run my application, I can see this getting hit. ModelState.IsValid is set to false correctly but when I inspect the ModelState

JavaScriptSerializer not deserializing DateTime/TimeSpan Properly

佐手、 提交于 2019-11-28 13:08:36
Having a problem where DateTime/TimeSpan doesn't seem to deserialize properly with JavaScriptSerializer. When I get the Object back after deserializing the TimeSpan is empty and if I use DateTime then the times are all out of whack. Did find this article but it didn't really help me too much. http://www.west-wind.com/weblog/ShowPost.aspx?id=471402 Anyone have any ideas? Should I maybe try the json.net library? public class JsonFilter : ActionFilterAttribute { public string Param { get; set; } public Type JsonDataType { get; set; } public override void OnActionExecuting(ActionExecutingContext

ASP.Net MVC 2 Controller's TryValidate doesn't validate the List<> items within the model

懵懂的女人 提交于 2019-11-28 12:42:27
How do you get a model's validation to also validate child objects in a generic list property. I have a model that I'm trying to validate, this is not what's being posted to the server, but a composite of some information posted, and information already on the server... for example. ... public class A { [Required] public string Property1 { get; set; } } ... public class B { public List<A> Values { get; set; } } ... if (!TryValidateModel(instanceofB)) { //this should fire, as one of A inside B isn't valid. return View(instanceofB); } When I try to validate the model instance of B, it won't

“Run Custom Tool” for resx files in MVC2 project (from an external application/script)

冷暖自知 提交于 2019-11-28 12:42:01
I am trying to get the localization for my MVC project working with our existing infrastructure for editing string resources. We store all our resource string in database tables and have a front end web UI to edit them with, and an export application which generated the .resx files. This all works great, but I am having a little difficulty with a new project using MVC2 and VS2010. I have asked another question on this, the answer to which almost got me there, but not quite. I have now changed the resources to be in a Resources folder (instead of App_GlobalResources), as recommended by a number

IIS7.5 ASP.NET MVC users hitting strange URLs: /(F(1xe9eXIxPz

喜欢而已 提交于 2019-11-28 12:26:00
We are getting reports from a small number of users that they are ending up on very strange paths in our web app, of the form: https://www.example.com/(F(1xe9eXIxPzMALrZu6xd_6LBxDDlJI3lH2lkSvREZZKCfPBH20SF5EcNql6uXvyBVLgiNZshp9vXxaEzuLa5zm8c4ruux6gqu3B90eXGNmKDypu-wKR4OW_GwQctfjCdoxFYcDlLwglfE6rICL3JGkxtq4jgxggiQgJopKZGzLJ_PF2lHY7NqXya8eDshkP9o8QFDad47U54TMsxEwKCki2xPV9d9VxxjmDhNg7aQb38X_OTxHtf9I7AxiccanJf4m0bo0ceEJ70Mv20XYaMSlA2))/some/path (Note: i've changed random chars in that in case its some kind of security leak, so don't bother trying to decode it - although if doing so might be

Problems updating w/ EF4 repo & MVC2 - can't update many-to-many graph

♀尐吖头ヾ 提交于 2019-11-28 12:20:17
问题 I can't seem to successfully update a many-to-many graph in MVC2 using EF4. I figured the simplest thing to do would be to Clear() the entire graph, call SaveChanges(), then rebuild the graph calling SaveChanges() again at the end, but it's not working. All my other properties ARE working, however. First, my Action Methods: public ActionResult EditReview(int id) { var game = _gameRepository.GetGame(id); var genres = _gameRepository.AllGenres(); var platforms = _gameRepository.AllPlatforms();

I can't add Microsoft.SqlServer.Management.Common to my ASP.NET MVC Application

限于喜欢 提交于 2019-11-28 11:56:45
I am trying to add a reference to the above assembly but it does not appear in my ASP.NET MVC .NET 4 (Not client) applications Assembly list. Does anyone know how to reference this Assembly? The Microsoft.SqlServer.Management.Common namespace resides in the Microsoft.SqlServer.ConnectionInfo.dll assembly. Microsoft.SqlServer.Management.Common Namespace (MSDN) Assuming the default installation folders you can find the Microsoft.SqlServer.ConnectionInfo.dll assembly in: C:\Program Files\Microsoft SQL Server\XXXX\SDK\Assemblies Where XXXX represents the version of SQL Server you're running: 80 ->

CSS Background-Image refuses to display in ASP.Net MVC

柔情痞子 提交于 2019-11-28 11:55:10
I am having trouble displaying an background image in my ASP.NET MVC 2 application. Currently, In ~/Views/Shared/Site.master, I set my link to the style sheet to: <link href="<%:@Url.Content("~/Content/Site.css") %>" rel="stylesheet" type="text/css" /> The image I plan to display is in my ~/Content/Images/Designs.png Here is what I have tried body { background-image: url(~/Content/Images/designs.png); background-repeat: repeat; font-size: .75em; font-family: Verdana, Helvetica, Sans-Serif; margin: 0; padding: 0; color: #696969; } Other Tries Included: background-image: url(./Content/Images