Recently I have been trying to port a classic ASP application to ASP.Net. The major thing to do was to keep using CAPICOM for encryption. The reason was that the data we encrypt goes to a 3rd party vendor who decrypts them using CAPICOM and they were not going to change their side of the program.
Two specific problems that I encountered whenever deploying my application to servers.
a.) Retrieving the COM class factory for component with CLSID {94AFFFCC-6C05-4814-B123-A941105AA77F} failed due to the following error: 80040154
This I could resolve by registering the CAPICOM dll on the server (regsvr32). I was assuming that this would not be necessary given that I have a .Net wrapper around the CAPICOM dll (using tlbimp. MSDN).
b.) Keyset does not exist
Searching on Bing/Google led me to several sites saying it's permission issue on the Machine Keys folder. I tried setting permission for all users I could think of: ASPNet, IUSR, IWAM, Service Account. But this did not help. Then I imported the certificate from the old machine where classic ASP application is running and voila! the encryption algorithm started working. I removed all permission settings for the ASP.Net users mentioned before and it still worked.
I am not sure why this is!
Thursday, September 29, 2011
Wednesday, September 28, 2011
Surface Area Configuration: Computer localhost does not exist on the network, or the computer cannot be configured remotely
I was trying to connect to a local instance of SQL Server from a Dev app server. The application would fail saying
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 0 - No process is on the other end of the pipe.)So I brought up the SQL Server Surface Area Configuration tool (Programs> SQL Server 2005> Configuration Tools >SQL Server Surface Area Configuration) and clicked on Surface Area Configuration for Services and Connections. And this will throw an error:
TITLE: Surface Area Configuration ------------------------------ Computer localhost does not exist on the network, or the computer cannot be configured remotely. Verify that the remote computer has the required Windows Management Instrumentation components and then try again. (SQLSAC) ------------------------------ ADDITIONAL INFORMATION: An exception occurred in SMO while trying to manage a service. (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.InnerWmiException&LinkId=20476 ------------------------------ Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476 ------------------------------ Invalid class (System.Management) ------------------------------ BUTTONS: OK ------------------------------While searching for a solution I came across this blog http://blogs.msdn.com/b/echarran/archive/2006/01/03/509061.aspx. Ran the command as mentioned there and I was able to bring up the Surface Area Configuration tool.
Thursday, September 8, 2011
Interdev connection failed: Method not allowed(Error code = 80070005)
I was recently re-writing a classic ASP web application into .Net. So I was trying to create a web project in Visual Studio InterDev when I got this error.
My environment: XP SP2, IIS 6.
Resolution: I did not have Microsoft FrontPage extensions installed.
To check
a.) go to Control Panel > Add Remove Programs > Add Remove Windows Component
b.) Select Internet Information Services (IIS)
c.) Click Details and ensure FrontPage 2000 Server Extensions option is checked. If not, check it and click OK.
That did it for me and may help you too.
Tuesday, July 19, 2011
Case Insensitive Replace() function
For some reason .Net framework does not have the case insensitive replace method in the String class. I found it can very easily be implemented for String class using Extension Method feature of .Net.
Here's the method:
And calling this method seems trivial:
That's it.
Here's the method:
public static string Replace(this string originalString, string oldValue, string newValue, StringComparison comparisonType)
{
int startIndex = 0;
while (true)
{
startIndex = originalString.IndexOf(oldValue, startIndex, comparisonType);
if (startIndex == -1)
break;
originalString = originalString.Substring(0, startIndex) + newValue + originalString.Substring(startIndex + oldValue.Length);
startIndex += newValue.Length;
}
return originalString;
}
And calling this method seems trivial:
originalString = originalString.Replace(@"ABCD", "abcd", StringComparison.InvariantCultureIgnoreCase);
That's it.
Monday, July 18, 2011
CSS Refresh issue in Firefox
While developing a website in ASP.Net I noticed that my CSS file was not immediately refreshed in Firefox and until I noticed; it caused me to think that the CSS I was trying is not correct. Ctrl+F5; Ctrl+R etc does not work.
I found modifying the entry in config did the trick for me:
But I believe it should not be that you have to modify config file for the new CSS to load into the browser. But for now this works.
I found modifying the entry in config did the trick for me:
network.http.use-cache = false
But I believe it should not be that you have to modify config file for the new CSS to load into the browser. But for now this works.
Monday, June 27, 2011
Metadata contains a reference that cannot be resolved
While adding a service reference to my project, I started getting an error
I had added other service references without issues and was having a bit of trouble finding out what the problem is. The suggestions given in browser (if you try to browse from IIS Manager) were about setting httpGetEnabled to true. So I checked in the web.config of my service site and found it was set to true.
When I opened the WCF config editor (my preferred way of modifying service site web config) I saw that the "Behavior Configuration" value for the the service was not set. Selecting the right behavior from the drop down was all that I needed to do.
The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'http://localhost/IDM.ProVue.DAWS/WS_Results.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost/IDM.ProVue.DAWS/WS_Results.svc. The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution and adding the service reference again.
I had added other service references without issues and was having a bit of trouble finding out what the problem is. The suggestions given in browser (if you try to browse from IIS Manager) were about setting httpGetEnabled to true. So I checked in the web.config of my service site and found it was set to true.
When I opened the WCF config editor (my preferred way of modifying service site web config) I saw that the "Behavior Configuration" value for the the service was not set. Selecting the right behavior from the drop down was all that I needed to do.
Wednesday, June 22, 2011
Dundas Chart and AJAX Calendar control overlap issue
The layout of my webpage (an ASP.Net content page) was:
Date PickerDundas Chart
The page displayed fine but if you click on the calendar image button of the calendar control, the view that pops up is rendered behind the chart control. This was happening in Chrome, FF & IE.
I found a discussion on Dundas support forum: http://support2.dundas.com/forum/tm.aspx?m=6100&mpage=1&key=&
Even after overriding the style class (.ajax__calendar or ajax__calendar_container) in my .css file I could not get the calendar to show up on top of the dundas chart.
Then I found a conversation on SO: http://stackoverflow.com/questions/302244/why-is-my-calendarextender-getting-overlapped-when-rendered
and the thing that worked for me was putting the style in the .ascx file
<*style type="text/css">.ajax__calendar_container { z-index : 1000 ; }<*/style>I am still not sure why this happens, but that's what worked for now. If I get a satisfactory explanation I'll post here.
Subscribe to:
Posts (Atom)