asp.net-4.5

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

僤鯓⒐⒋嵵緔 提交于 2019-12-06 05:03:20
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 configuration file. [SecurityException: Request for the permission of type 'System.Security.Permissions

handling null datetime in gridview

拜拜、爱过 提交于 2019-12-06 04:58:51
I have a gridview in C# asp.net Web 4.5 Framework that works great until a null valued is passed for a field I am formatting as a date.. here is my template field <asp:templatefield> <HeaderTemplate> <asp:Label ID="lblHeadEmailFirstSendDate" runat="server" Text="1st Email<br />Target Date"></asp:Label> </HeaderTemplate> <ItemTemplate> <asp:Label ID="lblEmailFirstSendDate" runat="server" Text='<%# Convert.ToDateTime(Eval("EmailTargetFirstSendDate")).ToString("MM/dd/yyyy")%>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:Label runat="server" ID="txtEmailFirstSendDate" Text='<%#Convert

Dynamically generate page linkbuttons for the PagerTemplate of a GridView

和自甴很熟 提交于 2019-12-05 21:54:47
From the MSDN page for the PagerTemplate of the GridView control (emphasis mine): Typically, button controls are added to the pager template to perform the paging operations. The GridView control performs a paging operation when a button control with its CommandName property set to "Page" is clicked. The button's CommandArgument property determines the type of paging operation to perform. "Next": Navigates to the next page. "Prev": Navigates to the previous page. "First": Navigates to the first page. "Last": Navigates to the last page. Integer value : Navigates to the specified page number.

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

孤者浪人 提交于 2019-12-05 21:54:20
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? 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-04 22:57:50
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\RC1Iteration05\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll" /r:CM_DataAnnotations="c:

VS2012 RTM missing .net 4.5 and mvc project templates

对着背影说爱祢 提交于 2019-12-04 07:28:39
On Windows 8 RTM and just installed Vs2012 Ultimate RTM, I'm unable to create a .net 4.5 project nor a .net 4 or 4.5 ASP.NET MVC project. I've done a repair of VS2012, which did not fix it. Is there something obvious I'm doing wrong? Your install is probably corrupted. VS 2012 needs .net 4.5 to run, so something has gone wrong if it's not available. I would try uninstalling and reinstalling. It's brute force but it generally works. I also had the same problem.. Doing the following procedure solved it. Copy the folder \packages\WPT from the visual studio 2012 installer CD to your desktop.

HttpRuntime.Cache Equivalent for asp.net 5, MVC 6

情到浓时终转凉″ 提交于 2019-12-03 18:11:11
问题 So I've just moved from ASP.Net 4 to ASP.Net 5. Im at the moment trying to change a project so that it works in the new ASP.Net but of course there is going to be a load of errors. Does anyone know what the equivalent extension is for HttpRuntime as I cant seem to find it anywhere. I'm using to cache an object client side. HttpRuntime.Cache[Findqs.QuestionSetName] 'Findqs' is just a general object 回答1: You can an IMemoryCache implementation for caching data. There are different

How do you parameterize deployments when using ASP.NET 4.5 publish profiles?

自古美人都是妖i 提交于 2019-12-03 13:27:28
问题 The new pubxml files in ASP.NET 4.5 are definitely a step in the right direction. I also like msdeploy 's support for parameters.xml files (even though they are sometimes not as powerful as I would like). Now, how do I combine msdeploy 's parameters and the pubxml files? I would expect that the pubxml files would allow me to provide a setting like <ParametersFile>productionParameters.xml</ParametersFile> or something similar in my production.pubxml file, that would contain values to be merged

Is MVC4 baked into .NET 4.5?

混江龙づ霸主 提交于 2019-12-03 10:46:42
A lot of release notes for Visual Studio 2012 talk about .NET 4.5 and MVC4, but I can't tell if MVC4 is actually part of the .NET 4.5 release. Anybody know for sure? I would love not to have to install MVC separately on my server. No, ASP.NET MVC 4 is baked into VS2012, exactly the same way ASP.NET MVC 3 was baked into VS2010 but not part of .NET 4.0 (there was a separate download that you could install on your servers). But there will also be a separate download of ASP.NET MVC 4 for VS2010 SP1 in which you obviously won't be able to use the .NET 4.5 specific features, such as async/await ,

How to pass/receive multiple args to a RESTful Web API GET method?

早过忘川 提交于 2019-12-03 09:39:00
问题 The usual examples of GET RESTful methods that take a parameter (returning a scalar value rather than a dataset) are shown like so: public string Get(int id) { //get and return the value } ...where the val passed is typically an ID, so you can use it to get a scalar value based on that unique value. What, though, if you want to pass multiple values, such as a string and an int? Is it simply a matter of defining a method like so: public string Get(string someString, int someInt) { //get and