asp.net-4.5

Bundling resources via bundle.config vs BundleConfig.cs in ASP.NET 4.5 WebForms

前提是你 提交于 2019-11-28 08:54:00
Regarding ASP.NET 4.5's new System.Web.Optimization / Microsoft.AspNet.Web.Optimization: Can anyone explain the difference in the use of bundling resources using the BundleConfig.cs class file as opposed to the bundle.config xml file? I've seen some articles showing bundling both js and css in BundleConfig.cs, while others showing bundling js in BundleConfig.cs and css in bundle.config. I guess I don't understand #1) why you wouldn't just do them both one particular way for simplicity - and #2) why anyone would prefer to hard-code resources like that in a class file? It seems like a much more

User.Identity.IsAuthenticated is false after successful login

你离开我真会死。 提交于 2019-11-28 07:22:40
I need to get the UserId Guid directly after a successful login. The following code doesn't work: if (Membership.ValidateUser(txtUsername.Value, txtPassword.Value)) { FormsAuthentication.SignOut(); FormsAuthentication.SetAuthCookie(txtUsername.Value, true); if (HttpContext.Current.User.Identity.IsAuthenticated) { // doesn't run Guid puk = (Guid)Membership.GetUser().ProviderUserKey; } } The following code does work: if (Membership.ValidateUser(txtUsername.Value, txtPassword.Value)) { FormsAuthentication.SignOut(); FormsAuthentication.SetAuthCookie(txtUsername.Value, true); MembershipUser user =

How create a MultipartFormFormatter for ASP.NET 4.5 Web API

你。 提交于 2019-11-28 02:04:00
问题 These links didn't help me: Way 1 Way 2 Example: //Model: public class Group { public int Id { get; set; } public File File { get; set; } } //Controller: [HttpPost] public void SaveGroup([FromBody]Group group) {} //Formatter: public class MultipartFormFormatter : MediaTypeFormatter { private const string StringMultipartMediaType = "multipart/form-data"; public MultipartFormFormatter() { this.SupportedMediaTypes.Add(new MediaTypeHeaderValue(StringMultipartMediaType)); } public override bool

requestValidationMode 4.5 vs 2.0

倖福魔咒の 提交于 2019-11-27 20:35:55
Is there a difference between requestValidationMode="4.5" and requestValidationMode="2.0"? I have a .net 4.5 application, there is a control which I don't want to validate, as users can enter html tags in: <asp:TextBox ID="txtTitle" runat="server" ValidateRequestMode="Disabled" /> in my web.config i have: <compilation debug="true" strict="false" explicit="true" targetFramework="4.5">...</compilation> <httpRuntime targetFramework="4.5" requestValidationMode="2.0" /> initially I have put requestValidationMode="4.5" but that didn't work, I would still get the error about the tags - "A potentially

Running Mono 3.2.0 with .NET MVC 4

时光毁灭记忆、已成空白 提交于 2019-11-27 18:44:23
问题 I am trying to get Mono 3.0 setup to run MVC4 sites under .NET 4 and .NET 4.5. I've been working through various errors, what can I do to get it up and running? Server Configuration CentOS 5 Apache 2.2.3 3.2.0 (tarball Sun Jul 28 00:57:40 UTC 2013); ASP.NET Version: 4.0.30319.17020 2013) Latest XSP from git, as of the time of this post Apache/Mono Config MonoServerPath "/usr/local/bin/mod-mono-server4" /usr/local/bin/mod-mono-server4 contents: #!/bin/sh exec /usr/local/bin/mono $MONO_OPTIONS

ASP.NET MVC 4 Areas in separate projects not working (view not found)

自闭症网瘾萝莉.ら 提交于 2019-11-27 17:54:05
I have tried to create simple proof-of-concept ASP.NET MVC 4 web site using areas in separate projects. I tried to following tutorials: http://bob.archer.net/content/aspnet-mvc3-areas-separate-projects (Application doesn't work in virtual directory... I use IIS). I hope there is better way than virtual directories. Then I tried this tutorial: http://forums.asp.net/t/1483660.aspx/1 But there is no "AreasManifestDir" element in *.csproj of area project (and got error "The view 'Index' or its master was not found or no view engine supports the searched locations") Is there still support in ASP

Build ASP.NET 4.5 without Visual Studio on Build Server

試著忘記壹切 提交于 2019-11-27 16:42:19
Its been a while since I setup a Build Server so maybe I've forgotten something or maybe .NET 4.5 is different from whatever version I did this with last time, but here is my problem. I'm trying to setup a build server to monitor a source control repository. Whenever something changes, I want the server to pull the changes and build the project. If there are no errors, I want to deploy the site to a web site running on the build server. In the past when I did this, I thought that I was able to do this having only .NET installed, but when I try to build this project I get an error that "C:

With C#, WCF SOAP consumer that uses WSSE plain text authentication?

梦想的初衷 提交于 2019-11-27 15:10:25
问题 I have a WCF SOAP consumer that is implemented by Visual Studio 2012 from a WSDL. The WSDL was generated by PeopleTools. The base object is of type System.ServiceModel.ClientBase . I need the SOAP request to resemble: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://xmlns.oracle.com/Enterprise/Tools/schemas"> <soapenv:Header> <wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open

Failed to load viewstate. The control tree into which viewstate is being loaded

假如想象 提交于 2019-11-27 14:48:24
问题 I am receiving the following error message after an HTTP POST on an ASP.NET form hosted inside a UserControl: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. Here's additional info: I'm running .NET 4.5 RC It

Upgrading to ASP.NET 4.5/MVC 4 forms authentication fails

别说谁变了你拦得住时间么 提交于 2019-11-27 12:52:15
I've just downoaded a VS 2012 along with ASP.NET 4.5 and MVC 4.0 and was kicking the tires with a sample app and found that the forms authentication that works perfectly with ASP.NET 4.0/MVC 3 no longer seems to work with the latest release. When I make a call to the Login function in the action controller, the WebSecurity.Login call fails: public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)) { return RedirectToLocal(returnUrl); } // If we got this far, something failed,