Search Results

Search found 50722 results on 2029 pages for 'web config transformation'.

Page 16/2029 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Update configSource of XML element in web.config using Powershell by passing in Parameters

    - by Howard
    I am trying to figure out a way to update my web.config for different environments by updating the configSource for the appSettings element in the web.config. Here are the way I know how to do it. $xml.get_DocumentElement().appSettings.configSource = $replaced_test The problem is that I want one base script where I can pass in different nodes to the script that I want to change and update but I am not sure how to do it. For example, I want to be able to call a powershell script like this changeWebConfig.ps1 nodeToChange newValueofNode I hope this was clear enough. This is the code I have now. $webConfigPath = "C:\web.config" # Get the content of the config file and cast it to XML $xml = [xml](get-content $webConfigPath) #this was the trick I had been looking for $root = $xml.get_DocumentElement()."system.serviceModel".client.configSource = $replace # Save it $xml.Save($webConfigPath)

    Read the article

  • web.config transforms not being applied on either publish or build installation package

    - by BenA
    Today I started playing with the web.config transforms in VS 2010. To begin with, I attempted the same hello world example that features in a lot of the blog posts on this topic - updating a connection string. I created the minimal example shown below (and similar to the one found in this blog). The problem is that whenever I do a right-click - "Publish", or a right-click - "Build Deployment Package" on the .csproj file, I'm not getting the correct output. Rather than a transformed web.config, I'm getting no web.config, and instead the two transform files are included. What am I doing wrong? Any help gratefully received! Web.config: <?xml version="1.0"?> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <connectionStrings> <add name="ConnectionString" connectionString="server=(local); initial catalog=myDB; user=xxxx;password=xxxx" providerName="System.Data.SqlClient"/> </connectionStrings> </configuration> Web.debug.config: <?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <connectionStrings> <add name="ConnectionString" connectionString="server=DebugServer; initial catalog=myDB; user=xxxx;password=xxxx" providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> </connectionStrings> </configuration> Web.release.config: <?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <connectionStrings> <add name="ConnectionString" connectionString="server=ReleaseServer; initial catalog=myDB; user=xxxx;password=xxxx" providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> </connectionStrings> </configuration>

    Read the article

  • Does <httpRedirect> in web.config work in a mono setup? Or is it IIS7 specific?

    - by Crystal
    We had some content restructure recently and I'd like to put in some redirect rules into web.config so bookmarks to the old pages can get routed to their new locations/pages. I tried using this approach: <location path="~/product/productA.aspx"> <system.webServer> <httpRedirect enabled="true" destination="~/product/category/productA.aspx" exactDestination="false" childOnly="true" httpResponseStatus="Permanent" /> </system.webServer> </location> But all I'm getting when I go to "http://www.oursite.com/product/productA.aspx" is our http 404 page. Am I doing something wrong, or is the httpRedirect tag in web.config not supported in mono? worked, but not ideal for what we want to achieve. Thank you :)

    Read the article

  • Web.Config issue with Unit Testing

    - by LeeHull
    I am trying to unit test a lot of my MVC controllers, but unfortunately it keeps failing because it needs a lot of settings from the web.config.. Which I copied over but does not read it, what I'm needing is the membership and rolemanager but I can't just add it to the app.config either, which I've been able to get the connection strings and application settings to work with.. Any idea how to get the web.config to work with MSTest?

    Read the article

  • How to Call my global value in app.config file

    - by deep
    Hai, am using c# and wpf am having my value as a string, i need to call the string value in my app.config file for example in app.config file am having my connection string. the username may vary diff time. am having the user name as a globasl string. i need to call that string in my app.config connection string when application startup????

    Read the article

  • Undefined Web.config error in VS 2008

    - by user1066050
    I'm working on a web app using VS 2008, .Net 3.5 and C#. Most of the projects in the solution are either classic asp.net pages with some MVC 1 in the mix, the rest is shared libraries. The solution is one that is some 5 years old and has gone through a variety of developers working on it and clearly has some performance and architectural issues. Previously, I've been working on the project using VS 2008 on a Win XP machine, but have just transitioned over to a new box using Win 7 Ultimate. To do so, I've installed VS 2008, asp.net 3.5. To support future work on the solution I've also installed VS 2010 and asp.net 4.0. Opening the solution on the new box with VS 2008 works fine, and it builds without error. However, when I attempt to run it with the debugger, I get the following message: "There is an error in web.config. Please correct before proceeding. (You might rename the current web.config and add a new one.)" I think it's clear that there is some sort of environmental issue regarding web.config on the new machine, but the error message is not "helpful". Adding a new web.config is not an option as the existing one is quite long and involved (too much to post here). I'm hoping someone has a suggestion or two about where I might look for missing elements or changed configurations that might produce such an error message. Lacking that, I'll revisit this post and provide the web.config in the hope that will elicit further help. Thanks to all in advance for taking a look at this. The StackOverflow community has helped me many times in the past with pertinent answers although this is my first posting. Jeff

    Read the article

  • App.config in Window service

    - by user171523
    I am in the process of designing a Windows Service, Where i have App.config. When the service is running i am not able to change the config values. But those values are not getting reflected. when it reades next time. Is it manadatory to restart service eveyr time we change config values? Do you have any suggestion how we can do this with out implementing some kind of file watch ?

    Read the article

  • Is web.config more secure than a class?

    - by o-logn
    I was reading a tutorial on ASP.NET and third party API's and it mentioned that the API KEY and SECRET KEY should be stored in the web.config file, for security on production servers, instead of in the classes that use them. However, I'm not quite sure what's more secure about a web.config file than a class? I understand the convenience of storing it in a config file, but I don't see the security benefit?

    Read the article

  • Finding final/effective web.config values (from inherited configurations)

    - by gregmac
    Are there any apps that can show the final configuration as applied to a particular application directory? What I'm picturing is something along the lines of FireBug's CSS viewer. Basically, it should show the equivalent single web.config file (as if you only had one), with all the values that apply to the directory in question, with each element (or even attribute) annotated with its source (the real .config file it came from). This would greatly help deploying applications into foreign environments (eg, customer sites) where they sometimes have strange configs, that add in global includes (eg, they put the include in machine.config, instead of the web.config for that app) or have allowOverride=false, etc.

    Read the article

  • Storing database settings outside app.config

    - by Piers
    I've been writing a c# exe that will be running on a live web server, but I want to be able to test it on our staging server. Since the staging server has different database settings (in the app.config) from my localhost, is there any way I can store the connection string outside the app.config so that I can easily get to it? Also, is it possible to store the database connection string, then access it via the app.config? This might sound odd, but I'm using a dll from a CMS that uses the value in the .config file.

    Read the article

  • app.config - where should it go?

    - by Piers
    This is a follow on from here: Storing database settings outside app.config So I know it's possible to have one app.config, with different sections externalised, all with different values. But are they like the web.config files in asp.net projects where you can just copy it into the same folder as the rest of the files and it will work, or do I need to compile it in somewhere. Also, won't it be overwritten by the .exe.config file? Edit Ok, so I worded this question a bit badly. I've updated it.

    Read the article

  • getting an exception when refreshing the configuration in memory on change to external config file

    - by RKP
    Hi, I have a windows service which reads the config settings from an external file which is located at a different path than the path to the executable for the windows service. the windows service uses a FileSystemWatcher to monitor the changes to the external config file and when it the config file is changed, it should refresh the settings in memory by reading the updated settings from the config file. but this is where I am getting an exception "ConfigurationErrorsException" and the message is "An error occurred creating the configuration section handler for appSettings: The process cannot access the file 'M:\somefolder\WindowsService1.Config' because it is being used by another process." and the inner exception is actually "IOException" with same message. here is the code. I am not sure what is wrong with the code. Please help. protected void watcher_Changed(object sender, FileSystemEventArgs e) { ConfigurationManager.RefreshSection(ConfigSectionName); WriteToEventLog(ConfigKeyCheck); if (FileChanged != null) FileChanged(this, EventArgs.Empty); } private void WriteToEventLog(string key) { if (EventLog.SourceExists(ServiceEventSource)) { EventLog.WriteEntry(ServiceEventSource, string.Format("key:{0}, value:{1}", key, ConfigurationManager.AppSettings[key])); } }

    Read the article

  • App.config path not correctly interpreted by ASP.NET Application

    - by seragu05
    Hello everyone ! I'm working on a very old project (2000) in VB6 which was "modernized" and upgraded to VB.NET 3.5. I've centralized every old INI configuration file into one MainApp.config, which is referenced by the app.config of every component. There's an VB ASP.NET website in the solution, which uses DLL components, which are looking into app.config for parameters like, say, error log directory, etc. I've deployed the site on my dev. server (Windows 2008 Server w/ IIS 7.0) into the D:\WebSite\ directory. Problem: When running the site, an error occurs. A DLL is looking into app.config for the parameter RepertoireErreur which has the value .\Erreurs\ Instead of returning D:\WebSite\Erreurs\ it returns c:\windows\system32\inetsrv\.\Erreurs\ which doesn't contain the Erreurs directory. Boom. Error. Does anyone have ever encountered the same problem ? Is there a solution ? Thanks,

    Read the article

  • Edit Settings in web.config

    - by Scott Selby
    I didn't know how to title this question - I am making a request to PayPal's Express Payment API. I am using their dll that helps make the request and parse the response. The instructions for their code to work is to add you authorization credentials in the web.config file. I have done so. My problem is that I want to be able to edit these credentials that are being set dynamically ( probably get from SQL ) because we are going to allow different users to enter their API credentials. Sending the request to PayPal looks like this Dim wrapper As New SetExpressCheckoutReq() wrapper.SetExpressCheckoutRequest = request Dim service As New PayPalAPIInterfaceServiceService() Dim setECResponse As SetExpressCheckoutResponseType = service.SetExpressCheckout(wrapper) There's not much room in there to edit the header of the request , because PayPalAPIInterfaceServiceService() is defined in their dll and applies its own header based on the credentials in the web.config. So, my question is , is there a way to point in the web.config to another location when it looks in web.config? I'm not to sure this is possible , also is there any way to edit the header of a request that is defined in a dll without changing the dll (to stay pci compliant) The line in the web.config is here: <account apiUsername="****" apiPassword="****" apiSignature="****"/>

    Read the article

  • Getting custom web.config sections and their contents in Powershell

    - by Rob
    I have a web application installed in c:\inetpub\wwwroot_Site1\AppName which has a custom section group and section as follows: <configSections> <sectionGroup name="Libraries"> <section name="Custom.Section.Name" type="System.Configuration.NameValueSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/> <section name="Custom.Section.Name2" type="System.Configuration.NameValueSectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/> </sectionGroup> </configSections> I've written the following snippet of Powershell: Import-Module WebAdministration Get-WebConfiguration //Libraries IIS:\Sites\Site1\AppName Which correctly returns: Name         Sections                           Groups ====          ========                        =========== Libraries    Custom.Section.Name                   Custom.Section.Name2 What I can't fathom is how to, either via Get-WebConfiguration or Get-WebConfigurationProperty obtain access to the <add key="x" value="y" /> elements that are direct children of CustomSectionName in the actual "body" of the configuration file.

    Read the article

  • Server.transfer causing HttpException

    - by salvationishere
    I am developing a C#/SQL ASP.NET web application in VS 2008. Currently I am using the Server.Transfer method to transfer control from one ASPX.CS file to another ASPX file. The first time through, this works. But after control is transferred to this new file it encounters a condition: if (restart == false) { where "restart" is a boolean variable. After this statement it immediately transfers control back to the same ASPX.CS file and tries to reexecute the Server.Transfer method. This time it gives me the following exception and stack trace. Do you know what is causing this? I tried to read this but it didn't make much sense to me. System.Web.HttpException was unhandled by user code Message="Error executing child request for DataMatch.aspx." Source="System.Web" ErrorCode=-2147467259 StackTrace: at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) at System.Web.HttpServerUtility.Transfer(String path) at AddFileToSQL._Default.btnAppend_Click(Object sender, EventArgs e) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\Default.aspx.cs:line 109 at System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) at System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException: System.Web.HttpCompileException Message="c:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx(14): error CS1502: The best overloaded method match for 'System.Web.UI.HtmlControls.HtmlTableRowCollection.Add(System.Web.UI.HtmlControls.HtmlTableRow)' has some invalid arguments" Source="System.Web" ErrorCode=-2147467259 SourceCode="#pragma checksum \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\" \"{406ea660-64cf-4c82-b6f0-42d48172a799}\" \"76750ABD913CF678D216C1E9CFB62BDF\"\r\n//------------------------------------------------------------------------------\r\n// \r\n// This code was generated by a tool.\r\n// Runtime Version:2.0.50727.3603\r\n//\r\n// Changes to this file may cause incorrect behavior and will be lost if\r\n// the code is regenerated.\r\n// \r\n//------------------------------------------------------------------------------\r\n\r\nnamespace ASP {\r\n \r\n #line 285 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Web.Profile;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 280 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Text.RegularExpressions;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 282 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Web.Caching;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 278 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Configuration;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 277 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Collections.Specialized;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 19 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n using System.Web.UI.WebControls.WebParts;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 289 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Web.UI.HtmlControls;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 19 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n using System.Web.UI.WebControls;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 19 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n using System.Web.UI;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 276 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Collections;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 275 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 284 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Web.Security;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 281 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Web;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 283 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Web.SessionState;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 279 \"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config\"\r\n using System.Text;\r\n \r\n #line default\r\n #line hidden\r\n \r\n \r\n [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]\r\n public class datamatch_aspx : global::AddFileToSQL.DataMatch, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {\r\n \r\n private static bool @_initialized;\r\n \r\n private static object @_fileDependencies;\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n public datamatch_aspx() {\r\n string[] dependencies;\r\n ((global::AddFileToSQL.DataMatch)(this)).AppRelativeVirtualPath = \"~/DataMatch.aspx\";\r\n if ((global::ASP.datamatch_aspx.@__initialized == false)) {\r\n dependencies = new string[1];\r\n dependencies[0] = \"~/DataMatch.aspx\";\r\n global::ASP.datamatch_aspx.@__fileDependencies = this.GetWrappedFileDependencies(dependencies);\r\n global::ASP.datamatch_aspx.@__initialized = true;\r\n }\r\n this.Server.ScriptTimeout = 30000000;\r\n }\r\n \r\n protected System.Web.Profile.DefaultProfile Profile {\r\n get {\r\n return ((System.Web.Profile.DefaultProfile)(this.Context.Profile));\r\n }\r\n }\r\n \r\n protected ASP.global_asax ApplicationInstance {\r\n get {\r\n return ((ASP.global_asax)(this.Context.ApplicationInstance));\r\n }\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.HtmlControls.HtmlTitle @_BuildControl_control3() {\r\n global::System.Web.UI.HtmlControls.HtmlTitle @_ctrl;\r\n \r\n #line 6 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.HtmlControls.HtmlTitle();\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.HtmlControls.HtmlHead @_BuildControl_control2() {\r\n global::System.Web.UI.HtmlControls.HtmlHead @_ctrl;\r\n \r\n #line 5 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.HtmlControls.HtmlHead(\"head\");\r\n \r\n #line default\r\n #line hidden\r\n global::System.Web.UI.HtmlControls.HtmlTitle @_ctrl1;\r\n \r\n #line 5 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl1 = this.@_BuildControl_control3();\r\n \r\n #line default\r\n #line hidden\r\n System.Web.UI.IParserAccessor @_parser = ((System.Web.UI.IParserAccessor)(@_ctrl));\r\n \r\n #line 5 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(@_ctrl1);\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 5 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n \r\n \r\n \r\n \r\n\"));\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.HtmlControls.HtmlTableRow @_BuildControl_control5() {\r\n global::System.Web.UI.HtmlControls.HtmlTableRow @_ctrl;\r\n \r\n #line 15 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.HtmlControls.HtmlTableRow();\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.WebControls.PlaceHolder @_BuildControlphTextBoxes() {\r\n global::System.Web.UI.WebControls.PlaceHolder @_ctrl;\r\n \r\n #line 19 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.WebControls.PlaceHolder();\r\n \r\n #line default\r\n #line hidden\r\n this.phTextBoxes = @_ctrl;\r\n \r\n #line 19 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.ID = \"phTextBoxes\";\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.HtmlControls.HtmlTableCell @_BuildControl_control8() {\r\n global::System.Web.UI.HtmlControls.HtmlTableCell @_ctrl;\r\n \r\n #line 18 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.HtmlControls.HtmlTableCell(\"td\");\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 18 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Align = \"center\";\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 18 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.VAlign = \"top\";\r\n \r\n #line default\r\n #line hidden\r\n System.Web.UI.IParserAccessor @_parser = ((System.Web.UI.IParserAccessor)(@_ctrl));\r\n \r\n #line 18 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n \"));\r\n \r\n #line default\r\n #line hidden\r\n global::System.Web.UI.WebControls.PlaceHolder @_ctrl1;\r\n \r\n #line 18 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl1 = this.@_BuildControlphTextBoxes();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 18 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(@_ctrl1);\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 18 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n \"));\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.WebControls.Label @_BuildControlInstructions() {\r\n global::System.Web.UI.WebControls.Label @_ctrl;\r\n \r\n #line 22 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.WebControls.Label();\r\n \r\n #line default\r\n #line hidden\r\n this.Instructions = @_ctrl;\r\n @_ctrl.ApplyStyleSheetSkin(this);\r\n \r\n #line 22 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.ID = \"Instructions\";\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 22 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Font.Italic = true;\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 22 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Text = \"Now select from the dropdownlists which table columns from my database you want t\" +\r\n \"o map these fields to\";\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.HtmlControls.HtmlTableCell @_BuildControl_control9() {\r\n global::System.Web.UI.HtmlControls.HtmlTableCell @_ctrl;\r\n \r\n #line 21 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.HtmlControls.HtmlTableCell(\"td\");\r\n \r\n #line default\r\n #line hidden\r\n System.Web.UI.IParserAccessor @_parser = ((System.Web.UI.IParserAccessor)(@_ctrl));\r\n \r\n #line 21 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n \"));\r\n \r\n #line default\r\n #line hidden\r\n global::System.Web.UI.WebControls.Label @_ctrl1;\r\n \r\n #line 21 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl1 = this.@_BuildControlInstructions();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 21 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(@_ctrl1);\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 21 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n \"));\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.WebControls.Button @_BuildControlbtnSubmit() {\r\n global::System.Web.UI.WebControls.Button @_ctrl;\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.WebControls.Button();\r\n \r\n #line default\r\n #line hidden\r\n this.btnSubmit = @_ctrl;\r\n @_ctrl.ApplyStyleSheetSkin(this);\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.ID = \"btnSubmit\";\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Text = \"Submit\";\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Width = new System.Web.UI.WebControls.Unit(150, System.Web.UI.WebControls.UnitType.Pixel);\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n ((System.Web.UI.IAttributeAccessor)(@_ctrl)).SetAttribute(\"style\", \"top:auto; left:auto\");\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n ((System.Web.UI.IAttributeAccessor)(@_ctrl)).SetAttribute(\"top\", \"100px\");\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Click -= new System.EventHandler(this.btnSubmit_Click);\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 26 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @__ctrl.Click += new System.EventHandler(this.btnSubmit_Click);\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.HtmlControls.HtmlTableCell @_BuildControl_control10() {\r\n global::System.Web.UI.HtmlControls.HtmlTableCell @_ctrl;\r\n \r\n #line 25 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.HtmlControls.HtmlTableCell(\"td\");\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 25 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Align = \"center\";\r\n \r\n #line default\r\n #line hidden\r\n System.Web.UI.IParserAccessor @_parser = ((System.Web.UI.IParserAccessor)(@_ctrl));\r\n \r\n #line 25 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n \"));\r\n \r\n #line default\r\n #line hidden\r\n global::System.Web.UI.WebControls.Button @_ctrl1;\r\n \r\n #line 25 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl1 = this.@_BuildControlbtnSubmit();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 25 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(@_ctrl1);\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 25 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n  \r\n \"));\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private void @_BuildControl_control7(System.Web.UI.HtmlControls.HtmlTableCellCollection @_ctrl) {\r\n global::System.Web.UI.HtmlControls.HtmlTableCell @_ctrl1;\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl1 = this.@_BuildControl_control8();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Add(@_ctrl1);\r\n \r\n #line default\r\n #line hidden\r\n global::System.Web.UI.HtmlControls.HtmlTableCell @_ctrl2;\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl2 = this.@_BuildControl_control9();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Add(@_ctrl2);\r\n \r\n #line default\r\n #line hidden\r\n global::System.Web.UI.HtmlControls.HtmlTableCell @_ctrl3;\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl3 = this.@_BuildControl_control10();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Add(@_ctrl3);\r\n \r\n #line default\r\n #line hidden\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.HtmlControls.HtmlTableRow @_BuildControl_control6() {\r\n global::System.Web.UI.HtmlControls.HtmlTableRow @_ctrl;\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.HtmlControls.HtmlTableRow();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Align = \"center\";\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 17 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n this.@_BuildControl_control7(@_ctrl.Cells);\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.WebControls.Literal @_BuildControllTextData() {\r\n global::System.Web.UI.WebControls.Literal @_ctrl;\r\n \r\n #line 34 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.WebControls.Literal();\r\n \r\n #line default\r\n #line hidden\r\n this.lTextData = @_ctrl;\r\n \r\n #line 34 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.ID = \"lTextData\";\r\n \r\n #line default\r\n #line hidden\r\n return @_ctrl;\r\n }\r\n \r\n [System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n private global::System.Web.UI.WebControls.Panel @_BuildControlpnlDisplayData() {\r\n global::System.Web.UI.WebControls.Panel @_ctrl;\r\n \r\n #line 31 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl = new global::System.Web.UI.WebControls.Panel();\r\n \r\n #line default\r\n #line hidden\r\n this.pnlDisplayData = @_ctrl;\r\n @_ctrl.ApplyStyleSheetSkin(this);\r\n \r\n #line 31 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.ID = \"pnlDisplayData\";\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 31 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl.Visible = false;\r\n \r\n #line default\r\n #line hidden\r\n System.Web.UI.IParserAccessor @_parser = ((System.Web.UI.IParserAccessor)(@_ctrl));\r\n \r\n #line 31 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralControl(\"\r\n \r\n \r\n \" +\r\n \" \"));\r\n \r\n #line default\r\n #line hidden\r\n global::System.Web.UI.WebControls.Literal @_ctrl1;\r\n \r\n #line 31 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_ctrl1 = this.@_BuildControllTextData();\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 31 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(@_ctrl1);\r\n \r\n #line default\r\n #line hidden\r\n \r\n #line 31 \"C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\DataMatch.aspx\"\r\n @_parser.AddParsedSubObject(new System.Web.UI.LiteralCont

    Read the article

  • Dependency Injection in ASP.NET Web API using Autofac

    - by shiju
    In this post, I will demonstrate how to use Dependency Injection in ASP.NET Web API using Autofac in an ASP.NET MVC 4 app. The new ASP.NET Web API is a great framework for building HTTP services. The Autofac IoC container provides the better integration with ASP.NET Web API for applying dependency injection. The NuGet package Autofac.WebApi provides the  Dependency Injection support for ASP.NET Web API services. Using Autofac in ASP.NET Web API The following command in the Package Manager console will install Autofac.WebApi package into your ASP.NET Web API application. PM > Install-Package Autofac.WebApi The following code block imports the necessary namespaces for using Autofact.WebApi using Autofac; using Autofac.Integration.WebApi; .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } The following code in the Bootstrapper class configures the Autofac. 1: public static class Bootstrapper 2: { 3: public static void Run() 4: { 5: SetAutofacWebAPI(); 6: } 7: private static void SetAutofacWebAPI() 8: { 9: var configuration = GlobalConfiguration.Configuration; 10: var builder = new ContainerBuilder(); 11: // Configure the container 12: builder.ConfigureWebApi(configuration); 13: // Register API controllers using assembly scanning. 14: builder.RegisterApiControllers(Assembly.GetExecutingAssembly()); 15: builder.RegisterType<DefaultCommandBus>().As<ICommandBus>() 16: .InstancePerApiRequest(); 17: builder.RegisterType<UnitOfWork>().As<IUnitOfWork>() 18: .InstancePerApiRequest(); 19: builder.RegisterType<DatabaseFactory>().As<IDatabaseFactory>() 20: .InstancePerApiRequest(); 21: builder.RegisterAssemblyTypes(typeof(CategoryRepository) 22: .Assembly).Where(t => t.Name.EndsWith("Repository")) 23: .AsImplementedInterfaces().InstancePerApiRequest(); 24: var services = Assembly.Load("EFMVC.Domain"); 25: builder.RegisterAssemblyTypes(services) 26: .AsClosedTypesOf(typeof(ICommandHandler<>)) 27: .InstancePerApiRequest(); 28: builder.RegisterAssemblyTypes(services) 29: .AsClosedTypesOf(typeof(IValidationHandler<>)) 30: .InstancePerApiRequest(); 31: var container = builder.Build(); 32: // Set the WebApi dependency resolver. 33: var resolver = new AutofacWebApiDependencyResolver(container); 34: configuration.ServiceResolver.SetResolver(resolver); 35: } 36: } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } The RegisterApiControllers method will scan the given assembly and register the all ApiController classes. This method will look for types that derive from IHttpController with name convention end with “Controller”. The InstancePerApiRequest method specifies the life time of the component for once per API controller invocation. The GlobalConfiguration.Configuration provides a ServiceResolver class which can be use set dependency resolver for ASP.NET Web API. In our example, we are using AutofacWebApiDependencyResolver class provided by Autofac.WebApi to set the dependency resolver. The Run method of Bootstrapper class is calling from Application_Start method of Global.asax.cs. 1: protected void Application_Start() 2: { 3: AreaRegistration.RegisterAllAreas(); 4: RegisterGlobalFilters(GlobalFilters.Filters); 5: RegisterRoutes(RouteTable.Routes); 6: BundleTable.Bundles.RegisterTemplateBundles(); 7: //Call Autofac DI configurations 8: Bootstrapper.Run(); 9: } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Autofac.Mvc4 The Autofac framework’s integration with ASP.NET MVC has updated for ASP.NET MVC 4. The NuGet package Autofac.Mvc4 provides the dependency injection support for ASP.NET MVC 4. There is not any syntax change between Autofac.Mvc3 and Autofac.Mvc4 Source Code I have updated my EFMVC app with Autofac.WebApi for applying dependency injection for it’s ASP.NET Web API services. EFMVC app also updated to Autofac.Mvc4 for it’s ASP.NET MVC 4 web app. The above code sample is taken from the EFMVC app. You can download the source code of EFMVC app from http://efmvc.codeplex.com/

    Read the article

  • ConfigurationManager.AppSettings is empty?

    - by Mattousai
    Hello All, I have a VS2008 ASP.NET Web Service Application running on the local IIS of my XP machine. A separate project in the same solution uses test methods to invoke the WS calls, and run their processes. When I added a web reference to the WS App, VS2008 created a Settings.settings file in the Properties folder to store the address of the web reference. This process also created a new section in the Web.config file called applicationSettings to store the values from Settings.settings When my application attempts to retrieve configuration values from the appSettings section of the Web.config file, via ConfigurationManager.AppSettings[key], all values are null and AppSettings.AllKeys.Length is always zero. I even reverted the Web.config file to before the web reference was added, and made sure it was exactly the same as a system-generated web.config file for a new project that works fine. After comparing the reverted Web.config and a new Web.config, I addded one simple value in the appSettings section, and still no luck with ConfigurationManager.AppSettings[key]. Here is the reverted Web.config that cannot be read from <?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <appSettings> <add key="testkey" value="testvalue"/> </appSettings> <connectionStrings/> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="false"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> </pages> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpModules> </system.web> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="WarnAsError" value="false"/> </compiler> </compilers> </system.codedom> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <remove name="ScriptModule" /> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <remove name="ScriptHandlerFactory" /> <remove name="ScriptHandlerFactoryAppServices" /> <remove name="ScriptResource" /> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </handlers> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> Has anyone experienced this, or know how to solve the problem? TIA -Matt

    Read the article

  • Bonnie.NET Web Edition - Digital Signature form ASP.NET Web Pages

    Cassandra relseases on the we-coffee.com site a new version of Bonnie.NET. The Bonnie.NET Web Edition (http://www.we-coffee.com/bonnie/bonnieWeb.aspx). This new version permits to digitally sign texts, files and from data from an ASP.NET web-pages. It integrates the PKCS#7 standard to permits signature and co-signature of data both form client-side that from server side. To permits digital signature from ASP.NET web pages, Bonnie.NET Web Edition contains three asp.net server controls,...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • New Features in ASP.NET Web API 2 - Part I

    - by dwahlin
    I’m a big fan of ASP.NET Web API. It provides a quick yet powerful way to build RESTful HTTP services that can easily be consumed by a variety of clients. While it’s simple to get started using, it has a wealth of features such as filters, formatters, and message handlers that can be used to extend it when needed. In this post I’m going to provide a quick walk-through of some of the key new features in version 2. I’ll focus on some two of my favorite features that are related to routing and HTTP responses and cover additional features in a future post.   Attribute Routing Routing has been a core feature of Web API since it’s initial release and something that’s built into new Web API projects out-of-the-box. However, there are a few scenarios where defining routes can be challenging such as nested routes (more on that in a moment) and any situation where a lot of custom routes have to be defined. For this example, let’s assume that you’d like to define the following nested route:   /customers/1/orders   This type of route would select a customer with an Id of 1 and then return all of their orders. Defining this type of route in the standard WebApiConfig class is certainly possible, but it isn’t the easiest thing to do for people who don’t understand routing well. Here’s an example of how the route shown above could be defined:   public static class WebApiConfig { public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: "CustomerOrdersApiGet", routeTemplate: "api/customers/{custID}/orders", defaults: new { custID = 0, controller = "Customers", action = "Orders" } ); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonpFormatter()); } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   With attribute based routing, defining these types of nested routes is greatly simplified. To get started you first need to make a call to the new MapHttpAttributeRoutes() method in the standard WebApiConfig class (or a custom class that you may have created that defines your routes) as shown next:   public static class WebApiConfig { public static void Register(HttpConfiguration config) { // Allow for attribute based routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } } Once attribute based routes are configured, you can apply the Route attribute to one or more controller actions. Here’s an example:   [HttpGet] [Route("customers/{custId:int}/orders")] public List<Order> Orders(int custId) { var orders = _Repository.GetOrders(custId); if (orders == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } return orders; }   This example maps the custId route parameter to the custId parameter in the Orders() method and also ensures that the route parameter is typed as an integer. The Orders() method can be called using the following route: /customers/2/orders   While this is extremely easy to use and gets the job done, it doesn’t include the default “api” string on the front of the route that you might be used to seeing. You could add “api” in front of the route and make it “api/customers/{custId:int}/orders” but then you’d have to repeat that across other attribute-based routes as well. To simply this type of task you can add the RoutePrefix attribute above the controller class as shown next so that “api” (or whatever the custom starting point of your route is) is applied to all attribute routes: [RoutePrefix("api")] public class CustomersController : ApiController { [HttpGet] [Route("customers/{custId:int}/orders")] public List<Order> Orders(int custId) { var orders = _Repository.GetOrders(custId); if (orders == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } return orders; } }   There’s much more that you can do with attribute-based routing in ASP.NET. Check out the following post by Mike Wasson for more details.   Returning Responses with IHttpActionResult The first version of Web API provided a way to return custom HttpResponseMessage objects which were pretty easy to use overall. However, Web API 2 now wraps some of the functionality available in version 1 to simplify the process even more. A new interface named IHttpActionResult (similar to ActionResult in ASP.NET MVC) has been introduced which can be used as the return type for Web API controller actions. To return a custom response you can use new helper methods exposed through ApiController such as: Ok NotFound Exception Unauthorized BadRequest Conflict Redirect InvalidModelState Here’s an example of how IHttpActionResult and the helper methods can be used to cleanup code. This is the typical way to return a custom HTTP response in version 1:   public HttpResponseMessage Delete(int id) { var status = _Repository.DeleteCustomer(id); if (status) { return new HttpResponseMessage(HttpStatusCode.OK); } else { throw new HttpResponseException(HttpStatusCode.NotFound); } } With version 2 we can replace HttpResponseMessage with IHttpActionResult and simplify the code quite a bit:   public IHttpActionResult Delete(int id) { var status = _Repository.DeleteCustomer(id); if (status) { //return new HttpResponseMessage(HttpStatusCode.OK); return Ok(); } else { //throw new HttpResponseException(HttpStatusCode.NotFound); return NotFound(); } } You can also cleanup post (insert) operations as well using the helper methods. Here’s a version 1 post action:   public HttpResponseMessage Post([FromBody]Customer cust) { var newCust = _Repository.InsertCustomer(cust); if (newCust != null) { var msg = new HttpResponseMessage(HttpStatusCode.Created); msg.Headers.Location = new Uri(Request.RequestUri + newCust.ID.ToString()); return msg; } else { throw new HttpResponseException(HttpStatusCode.Conflict); } } This is what the code looks like in version 2:   public IHttpActionResult Post([FromBody]Customer cust) { var newCust = _Repository.InsertCustomer(cust); if (newCust != null) { return Created<Customer>(Request.RequestUri + newCust.ID.ToString(), newCust); } else { return Conflict(); } } More details on IHttpActionResult and the different helper methods provided by the ApiController base class can be found here. Conclusion Although there are several additional features available in Web API 2 that I could cover (CORS support for example), this post focused on two of my favorites features. If you have .NET 4.5.1 available then I definitely recommend checking the new features out. Additional articles that cover features in ASP.NET Web API 2 can be found here.

    Read the article

  • Java Web Service - Faulty Services - ClassNotFound Exception

    - by Epitaph
    My Project has 2 java files (A.java and B.java in same package). A.java uses methods in B.java. And, an external jar has been added in the project build path. In order to create a web service (bottom up) from the class, I created a new Dynamic Web Project in Eclipse with axis2 as the runtime platform, and imported A.java and B.java source files. Next, since all my methods that need to be exposed are contained in A.java, I right click on it and created web service using the standard settings. When I deploy the web service on my apache, I get "Fault Service" and a few ClassNotFound Exceptions for some of the classes in my external jar file (I have already imported it as an external jar). Does the external jar needs to be imported in another way?

    Read the article

  • Web Platform Installer 2.0 and Visual Studio Web Developer 2010 Express

    - by The Official Microsoft IIS Site
    I was setting up a new machine for presentations and I was getting ready to install Visual Studio 2010 Express   and figured I'd go see if the Web Platform Installer (we call it "Web-P-I") had the new versions of VS2010 ready to go. If you're not familiar, I've blogged about this before. WebPI is a 2meg download that basically sets up your machine for Web Development and downloads whatever you need automatically. It's a cafeteria plan for Microsoft Web Development....(read more)

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >