web-config

Login Membership .NET

自作多情 提交于 2019-12-22 16:40:06
问题 Hi I was wondering what is the best way to force the user to login when arriving at a website, in .net. I have set up the Membership features and I was wondering what is the best way to ensure that no matter what address the user arrives at, they must first get authenticated before proceding to the page they requested. Any resources will be great, thanks. 回答1: Alter Web.config in application root to read: <authentication mode="forms"> <forms loginUrl="Login.aspx" defaultUrl="/" /> <

Allow anonymous user to browse the Style and Images folder

余生长醉 提交于 2019-12-22 10:19:40
问题 I am writing an ASP.NET web application. I have a login screen that has some CSS styles and images on it. I ran into an issue where the styles and images weren't displaying. I read online and it said I needed a web.config inside my Content folder. I added the following to the web.config: <configuration> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </configuration> This seemed to work on my local machine. However, when I publish to inetpub on the server, it

Add Config Transforms is not displaying, why?

若如初见. 提交于 2019-12-22 10:08:50
问题 I don't know if this is an environmental issue or something; however, I have been in Configuration Manager and I have added a new "Test" and "Release", now those appear along with Debug. I went to my Web.config and right clicked and I am not seeing the "Add Config Transforms". My end goal is to change the based on what environment I am publishing to. What are my options to make this work? 回答1: Is the project a Web Site? The web.config transforms seem to be only available for Web Application,

When does the empty MailMessage constructor work?

梦想与她 提交于 2019-12-22 09:39:36
问题 We have an Asp.Net solution that's been in production for over 2 years using System.Net.Mail.MailMessage with the empty constructor: using (MailMessage _mailMessage = new MailMessage()) // Exception thrown here { _mailMessage.From = new MailAddress(sFrom); // Setting additional properties - never gets here _mailMessage.Body = sBody; _mailMessage.Subject = sSubject; _mailMessage.IsBodyHtml = true; Yesterday we had a live site report the exception: The specified string is not in the required

Autofac Losing Registrations on Web.Config Edit

给你一囗甜甜゛ 提交于 2019-12-22 09:14:29
问题 I have a layered web application that I built with ASP.NET MVC 4, WebAPI and some other components. I'm using the latest release of Autofac 2.6.2.859 as my DI container along with the MVC and WebAPI integrations. I have autofac modules setup in my different layers and I'm using the new RegisterAssemblyModules to scan the AppDomain assemblies for the various modules. On startup every works great. When I edit the web.config file and the application warms up, my registrations are lost. I get a

Changing your web.config from your ASP.NET application

萝らか妹 提交于 2019-12-22 08:37:21
问题 I need to change the database connection string in the web.config file but havent got a clue how to go about this. Does anyone have any experience with that? UPDATE Sorry, not very clear above, I want to be able to change a connection string from the web application after it has been deployed 回答1: Configuration myConfiguration = WebConfigurationManager.OpenWebConfiguration("~"); //appSettings configuration myConfiguration.AppSettings.Settings["xxx"].Value = "yyy"; //database connections

Preserve mutliline attributes and indentations with xml.document in Powershell

。_饼干妹妹 提交于 2019-12-22 08:37:20
问题 I'm using Powershell with to read in and modify a web.config file, all operations are executing successfully but I am losing indentation and new breaks in multiline attributes upon saving the file. Here is what the web.config file looks like prior to editing: <maintenance isSet="false" startDate="2012-03-07T00:00:00" endDate="2012-03-07T23:59:59"> <allowedIPAddresses> <add name="Johns Machine" address = "xx.xx.xxx.xx" /> <add name="Marys Machine" address = "xx.xx.xxx.xx" /> <

Azure role configuration management

泪湿孤枕 提交于 2019-12-22 06:59:32
问题 I don't see how Windows Azure lets you vary the configuration of an application when you have no choice but to hold configuration settings in web.config (or app.config). For example... Quite often projects will make use of a 3rd party library that makes heavy use of web.config. The use of web.config may involve connection strings, app settings or custom configuration sections. A good example of this is ELMAH. A web.config file for ELMAH might look like the following: <configuration>

Yet another Could not load file or assembly 'EntityFramework

本秂侑毒 提交于 2019-12-22 06:36:03
问题 Now, I promise that I've googled this. Stack overflow has about 4 or 5 solutions to this issue. Still, none of them seem to be working. I'm using EntityFramework 5 (4.4) with an MVC 3 project. This has worked fine in the past, but it's been a while since I've opened the project (about 20 days or so). I've just uninstalled & reinstalled Sql Server 2008 R2 Express. I've rebooted since then. In all of my cshtml files I see an error underlineline on my @model line. When I mouse over it, I see the

IIS7 & Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule registering problems

若如初见. 提交于 2019-12-22 06:35:41
问题 UPDATE: In Windsor 2.5 the assembly name is Castle.Windsor not Castle.MicroKernel I'm trying to deploy an ASP.NET MVC app to IIS7 and I'm getting this error: Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule Add '' to the section on your web.config My httpModules contains: <httpModules> <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel"/> </httpModules> system.webServer