View Complete Post
I have the following authorization settings in my web.config:
<deny users="?" />
This deny's all anonymous access to the application accept the login
page. In addition to this I am using authorization within each
controller action via a custom authorize attribute.
I have one additional action that I would like to expose publicly in
addition to the login page. This action does not have the authorize attribute on it. I have tried to make this view
(resetPassword view) public by using the location tag in the web.config
file like so:
<location path="Account/ResetPassword" allowOverride="false">
<allow users="*" />
In the path attribute above I have tried both the view as well as the
action path, but it doesnt allow public access to the action.
I have even tried to put this view in a separate folder within the
shared folder and put a separate web.config file to make that folder
public like so:
One of my NUnit tests has to read in some values from config files. In my main application this process works perfectly well, however when I run the unit test, the code that reads in the values from the config files doesnt read anything in. Ive tried putting app.config in my unit test project (I even tried web.config) but nothing seems to work. Are there any special steps involved when reading from config files in an nunit test ?
Ive created an NUnit test project in my solution and have added 3 tests. They all fail with the same error
SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
----> System.NullReferenceException : Object reference not set to an instance of an object.
heres the test method
public void CreateDataContext_ConnectionString_ReturnsDataCon
Im trying to create a Web Deployment Project, the built in setup and deployment is very good in Visual Studio, i need to able to add an additional step in the setup to change the connection string in the Web config file. Ive seen a lot of articles on how to do this and in particular this http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx#7162670 I am however stuck on the final part of this tutorial, im using the code Scott provided but have two errors, heres part of my code where the errors are
void ConfigureDatabase(string targetSite, string targetVDir, string connectionString)
// Retrieve "Friendly Site Name" from IIS for TargetSite
DirectoryEntry entry = new DirectoryEntry("IIS://LocalHost/" + targetSit
I have a web application that is actually installed as a component of a third party site. In some configurations, I need to remove certain connection strings and re-add them. I'm replacing this web.config section with a xml file that includes the following:
<connectionStrings> <remove name="MyOverridenConnection"/> <add connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data Source=MyServer" name="MyOverridenConnection" providerName="System.Data.SqlClient"/> </connectionStrings>
For some reason the remove tag is left out during the substitution and I end up with the following in the installed config:
<connectionStrings> <add connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data Source=MyServer" name="MyOverridenConnection" providerName="System.Data.SqlClient"/> </connectionStrings>
Is there any way to issue removes in replaced sec
We show you how to build a location-aware task list application for Windows Mobile devices that uses GPS to remind you of a task when and where it's appropriate.
MSDN Magazine January 2009
Even though you've been using ASP. NET for a while, how much do you really know about ASP. NET configuration files? While you've probably touched the Web. config file from time to time, there are some nuances involved in configuring ASP.
MSDN Magazine September 2004
MSDN Magazine April 2003
I am working on a MVC project with Razor view engine and I have the following:
This only works if I have on the same view the following:
However, on my Web.Config I have the following:
<!-- Namespaces -->
So if "SquishIt.Framework" namespace is added on Web.Config why do I need to have the @using on the view?
I would like to secure any URL below the http://MyServer/Admins and limit it to a specific role.
In webforms it was straight forward. I just put a child web.config in the /Admin/ folder and add <authorization> <allow roles> tags to it.
How would be the equivalent technique in MVC?
I'm asking this question AFTER I've already solved my problem - I just wanted more info about it.
Each time I tried to create a ViewUserControl with a specific model template like this:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProject.Web.ContactFormContent>" %>
The control would not compile properly and intellisense would not show things like Html and ViewData.
However, when I add the attribute pageParserFilterType to the <pages> in web.config, everything works:
please help - the problem is in post subject.
I have lots of warnings with following text:
"Warning 10 Element 'HyperLink' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing. C:\Users\Pavel\Documents\Visual Studio 2010\WebSites\BioWebSite\ToScientist.aspx 26 18 C:\...\BioWebSite\"
But web.confg is there! And there's no compilation error!
Site builds just fine. And If I upload it to my hoster - it works!
But with all these errors I cant add controls to pages - VS2010 adds hyperlink without ID, and intelisens stoped to work.
Strange, but in my other project (web-application) I have no such difficuty.
Presently I have a gridview, I'm in the process of populating the gridview. One colunm "Location" is displayed as the guid ID. I need for that colunm to be displayed as the location. Here some of the code to display the grid.
myObject orgs = new myObject();
grid.DataSource = orgs;
orgs gets a list of organizations (locations) for the grid. How can I replace the guid ID with it location. Yes the guid ID and location are in a table.
We have sepeartate folder called Managers in one of our web apps. And there was a security build around that folder in a web config file as below
<?xml version="1.0"?><configuration> <appSettings/> <connectionStrings/> <system.web> <authorization> <allow roles="AllManagers"/> <deny users="*"/> </authorization> </system.web></configuration>
I couldn't figure out where this group located in the application. Usually all our groups are defined in Active directory but except this group. I am not sure if this is defined on the web server or some where in the app itself. Because in the process of figuring out I have changed it to <allow users="*"/> just to make sure if this is the group we are looking for and YES It is and I have access to it. So I need to find out where this is located and add myself as one of the users to this group.
Can any one help me with this mystery.
Thanks in advance,
see i used to have a security filter settings in web config
but it gets deleted automatically after i dont know why
we tried to install something in our server yesterday it didn't worked and reverted it back to yesterdays stage( But i had updated the config files 3 weeks ago)
but today i check the config files these elements are not there.
My system is 64 bit windows server 2008 with IIS 7 and MOSS 2007 SP2