asp.net-4.5

The “EnsureBindingRedirects” task failed unexpectedly

可紊 提交于 2019-12-09 05:00:23
问题 When I create new ASP.NET 4.5 web forms application from vs2012 and update all nuget packages, I receive this error on build: Error 1 The "EnsureBindingRedirects" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object. at Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsFromElements(IEnumerable`1 dependentAssemblies) at Roxel.BuildTasks.EnsureBindingRedirects.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft

How to use MachineKey.Protect for a cookie?

▼魔方 西西 提交于 2019-12-09 04:32:27
问题 I want to encrypt the ID that I am using in a cookie. I am using ASP.NET 4.5 so I want to use MachineKey.Protect to do it. Code public static string Protect(string text, string purpose) { if (string.IsNullOrEmpty(text)) return string.Empty; byte[] stream = Encoding.Unicode.GetBytes(text); byte[] encodedValue = MachineKey.Protect(stream, purpose); return HttpServerUtility.UrlTokenEncode(encodedValue); } public static string Unprotect(string text, string purpose) { if (string.IsNullOrEmpty(text

How do I update the client with server side variables during a lengthy loop?

三世轮回 提交于 2019-12-08 13:52:19
问题 I am trying to put a web interface on a lengthy server side process which should send regular progress\statistic reports to the client as the process is running. How can I do this? Here is what I have attempted so far. The session in the webmethod is null for as long as the loop is processing. Once the loop is finished and you press the start button again, it is able to pick up the session value and populate the label. How do I get this to send updates to the client while the process is

Sitecore context in HttpHandler

别说谁变了你拦得住时间么 提交于 2019-12-08 06:44:41
问题 I have HttpTaskAsyncHandler in my sitecore solution and i call it I have sutup IngnoreUrlPrefix and etc. By some reason i can't get access to SC.Context.Database Database is null in ProcessRequestAsync(HttpContext context) method, it looks like I don't access to Sitecore context in HttpHandler. How to resolve it ? Thanks. 回答1: You wont be able to access Sitecore Context (Database or Item) in the Handler. We have confirmed this with Sitecore Support for our task. The best way is Implement a

asp.net MVC 4, tagging places - best practice (eg Pub, Store, Restaurant)

て烟熏妆下的殇ゞ 提交于 2019-12-08 04:13:50
问题 ASP.NET MVC 4 web app, EF 5, SQL Server 2012 Express, Visual Web Developer 2012 Express, Code First I have a places object - I would like to add multiple tags to each place. Is the best approach a comma separated string or related object? Any design patterns or ways to manage the whole thing (adding, looking up, associating with a place etc)? Good performance is also of interest. Tagging is done by administrators so speed / ease of implementation at the cost of a little ease of use is

Visual Studio 2013 Web Forms Site doesn't work with trust level “Medium”

主宰稳场 提交于 2019-12-08 02:51:24
问题 I've created an asp.net Web Forms site with Visual Studio 2013. Scripts and pages are generated automatically by VS 2013. The problem is that the website doesn't work with the .Net trust level "Medium". It reqires "Full" level. With the "Medium" Level it throws an error: The application attempted to perform an operation not allowed by the security policy. To grantthis application the required permission please contact your system administrator or change the application's trust level in the

Is it possible to call async Page_Load in asp.net 4.5?

拜拜、爱过 提交于 2019-12-07 17:50:38
问题 I wish to know whether it possible to call async Page_Load in asp.net 4.5 like async controllers in ASP.Net MVC 4. If it is possible, how do we use async events in asp.net? 回答1: You could use the PageAsyncTask Pretty simple to use. You basically create your async task and then register it with the page and execute it. The link above has a good example. 来源: https://stackoverflow.com/questions/8242375/is-it-possible-to-call-async-page-load-in-asp-net-4-5

Type definition exists in two libraries

自闭症网瘾萝莉.ら 提交于 2019-12-06 17:15:38
问题 I am building an ASP.NET Web Forms web site using .NET 4.5. The error ... The type 'System.ComponentModel.DataAnnotations.Schema.ForeignKeyAttribute' exists in both 'f:\Projects\web sites\RC1Iteration05\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ComponentModel.DataAnnotations.dll' I have tried to alias the libraries using ... csc /r:EF_DataAnnotations="f:\Projects\web sites

Dynamic width for twitter bootstrap dropdown menu?

淺唱寂寞╮ 提交于 2019-12-06 11:39:46
问题 I am working on a new layout for my ASP.Net site and am taking advantage of the twitter bootstrap but can not get the dropdown menu working 100%. I have a menu labled "Media" and when you click on the submenu pops down like it should but the width of the submenu does not expand it's width dynamicly to fit all the text in 1 line. You can see what I am talking about by going to http://ffinfo.azurewebsites.net/webform1.aspx. If you look at the Media drop out the final menu option should be on

MVC Web API, get sub items

こ雲淡風輕ζ 提交于 2019-12-06 05:50:45
I have a database with two tables. Countries and Cities where each city has a relation to a spesific country. In my ASP.Net Web API I can get a list of countries by a GET request to http://example.com/api/countries to run the CountriesController. And I can get details about a country by http://example.com/api/countries/1 . If I want a list of all cities for a country the REST query URL should be http://example.com/api/countries/1/cities ? And details for a City http://example.com/api/countries/1/cities/1 How can I accomplish this in ASP.Net Web API? How about this, in global.asax.cs define an