Posts

ASP.NET 2.0 DropDownList EnableViewState

In ASP.NET 2.0 the  DropDownList   EnableViewState  doesn't work the same as other controls like GridView . Fortunately Anson Goldade created one that does. You can learn how here:  http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.aspnet.webcontrols/2006-02/msg00149.html

Add Charset and ContentType to ASP.NET web page

The WC3 recommends specifying the Charset and ContentType on all of your web pages. A quick and easy way to do this in a ASP.NET web site with a master page is to add this to the masterpage file: <% Response.Charset = "utf-8" %> <% Response.ContentType = "text/html" %>

system.diagnostic trace not creating file in asp.net

Image
If your S ystem .D iagnostic trace is not creating a file in asp.net make sure the the user that the website/webapp is running under has write permissions to the log file folder(default is web root ie where the web.config is). You can find the user that the website/webapp is running under by going into IIS. Go to the application pool that the website/webapp is running under and the Identity column will show the user that needs write permissions to the log file folder.

Where are UnityContainerExtensions

Image
I had wrapped a Unity container in another class and then was using it to call Resolve and only got one option in intellisense like this: But I was wanting the Resolve(Of T) option like this: Then I discovered I was missing "Imports Microsoft.Practices.Unity" at the top of the class.  Once I added that then the UnityContainerExtensions became available.

How to upgrade a web service to ASP.NET 4.0 with out affecting other services

After you have installed .NET 4.0 on the server open a command window and run: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -norestart -s W3SVC/ID/root/ Replace ID in the line above with the Identifier of the Web Service.  The Identifier can be found by starting the IIS snap in and clicking on the "Web Sites" folder and looking in the right pane.  

How to correctly call a web service in .NET

I came across a problem with calling web services that I had never heard about before. I was creating the client with a Using statement like so: Dim xml As XDocument = TestXml Dim actual ( ) As Byte Using proxy As New My WebService .My ServiceClient actual = proxy . GenerateForm ( xml . Root ) End Using Assert . IsNotNull ( actual ) This is apparently a no no, as it can mask the real error.  For me I was getting this error: "System.ServiceModel.ChannelFactory`1[MyLibrary.PNetTServices.PNetTServicesSoap],  cannot be used for communication because it is in the Faulted state." When in reality when I switched to the recommended client call( http://msdn.microsoft.com/en-us/library/aa355056.aspx ): Dim xml As XDocument = MyXml Dim actual ( ) As Byte Dim proxy As My WebService .My ServiceClient = Nothing Try proxy = New My ...

Using WCF with non-microsoft clients

The default wsdl that WCF creates isn't very friendly for human's and other non-microsoft clients to read. To remedy this you can intsall WCFExtras: http://wcfextras.codeplex.com/ To use it, in your endpoint declaration add a " behaviorConfiguration " element with a name something like " WsdlRedirect ". Then add an endpointBehaviors declaration something like this:       < behaviors >        < endpointBehaviors >          < behavior name =" WsdlRedirect " >            < wsdlExtensions location =" https://testwebservices.website.ca/SomeService.svc "                            singleFile =" True " / >          < / behavior >   ...