Thursday, August 12, 2010

Open file in Binary mode DOS

How can we open a .dat or text or any file on Binary mode?

Ans :
open command prompt and type "edit /70

/70
tell the command prompt to open the file in the Binary mode.

Tuesday, August 10, 2010

Using EVAL in asp.net

http://www.15seconds.com/issue/040630.htm


In ASP.NET 2.0, you should generally use the Eval method. And, to make this easier, the DataBinder object that exposes it has been made the default context for all non-hierarchical (rows and columns) data binding expressions. This means that you can use a much simpler syntax. If you just want to display a value without formatting it, use the Eval method directly:


<%# Eval("expression") %>

Or, if you need to format the value, use the second overload that accepts a format string:

<%# Eval("expression"[, "format"]) %>

The format parameter works here just like it does in v1.x. So, for example, you can format the value in a column named Price as currency using:

<%# Eval("Price", "{0:C}") %>

And, as in v1.x, you can use more complex format strings to display text as well as the current row value:

<%# Eval("Price", "Special Offer {0:C} for Today Only!") %>

Friday, July 23, 2010

Hosting WCF services in IIS7 and Windows Vista

Link from http://live.mscommunity.net/blogs/borissevo/archive/2007/10/30/hosting-wcf-services-in-iis7-and-windows-vista.aspx

Hosting WCF services in IIS7 and Windows Vista

Today I spent almost 2 hours trying to run a WCF service hosted in IIS7. After I read a lot of blog and forum posts I finally got a solution which works. Basically, you just need to do this four steps:

Step1: Change the C:\Windows\System32\inetsrv\config\applicationHost.config file. You must add handlers section and one mimeMap tag.

<location path="Default Web Site" overrideMode="Allow">
<system.webServer>
<asp />
<handlers>
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />
<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
</handlers>
</system.webServer>
</location>
...
<staticContent>
...
<mimeMap fileExtension=".svc" mimeType="application/octet-stream" />
...
</staticContent>

Step2: Then you should run servicemodelreg with a -i option:
C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg -i

Step3: Turn a Windows Communication Foundation HTTP Activation feature on. Go to Add/Remove programs, Turn Windows Features on/off and install Windows Communication Foundation HTTP Activation (it is in a Microsoft .NET Framework 3.0 section).

Step4: Go to IIS Manager and add new application to your web site (you must choose Add Application ... option, I also tried with a Add Virtual Directory ..., but it didn't work for me) which physical path will point to your WCF service.

That's all. I hope it will help you if you run in a similar problem.

Friday, May 28, 2010

The type initializer for 'AuthenticationServ.Authentication' threw an exception.



I had this issue before as well but I couldn't remember what I did at that time to fix this issue.
Anyway, I ended up spending hours trying to fix this again.

This is not something a good developer should be doing.
A good develope should always take a note of the issue and remember the fix he did for it.

N'way the fix was simple, it was caused since we were missing log4net.config file in the bin folder.

Thursday, April 29, 2010

log4net :: Configuration for the last 100 days

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<!-- Pattern to output the caller's file name and line number -->
<conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" />
</layout>
</appender>

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="log\RTIService.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<maxSizeRollBackups value="100" />


<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%datetime %-5level %logger (%file:%line) - %message%newline" />
</layout>
</appender>

<root>
<!-- level value="DEBUG" /-->
<level value="DEBUG" />
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>

<!-- Print messages of level DEBUG or above in the package RTIService -->
<logger name="RTIService">
<level value="DEBUG" />
</logger>

</log4net>

Monday, March 22, 2010

Enabling / Disabling Client Based Globalization

For Client Based Globalization :-

globalization uiCulture="auto" culture="auto" resourceProviderFactoryType="Rubik.IB.Common.Resource.CustomResourceProviderFactory, Rubik.IB.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=
aafffa"

For Server Based Globalization : -

globalization enableClientBasedCulture="false" uiCulture="en-AU" culture="en-AU" resourceProviderFactoryType="Rubik.IB.Common.Resource.CustomResourceProviderFactory, Rubik.IB.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=
aafffa"

Thursday, December 10, 2009

When Logs are crated get created under C:\Windows folder

When Logs are crated get created under C:\Windows folder

Solution :

System.IO.Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

Thursday, November 19, 2009

Unable to login when both Form Authentication and Windows Authentication is implmented

Error we were receiving :

Event code: 4006
Event message: Membership credential verification failed.
Event time: 19/11/2009 12:43:51 PM
Event time (UTC): 19/11/2009 1:43:51 AM
Event ID: 1bedfdd7dd734d0c8cbba1a3ae61c019
Event sequence: 112
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/80145796/Root/RubikIBS-23-129029908738237500
Trust level: Full
Application Virtual Path: /RubikIBS
Application Path: C:\Inetpub\wwwroot\mobi\RubikIBS\
Machine name: SWIFT_HOMEBANK

Process information:
Process ID: 8352
Process name: aspnet_wp.exe
Account name: SWIFT_HOMEBANK\ASPNET

Request information:
Request URL: http://10.11.3.17:4747/RubikIBS/Login.aspx
Request path: /RubikIBS/Login.aspx
User host address: 10.10.9.99
User:
Is authenticated: False
Authentication Type:
Thread account name: SWIFT_HOMEBANK\ASPNET

Name to authenticate: 1938113

Custom event details:

For more information, see Help and Support Center at


Well the issue was caused since the password in the database was changed hence it was authenticated via the forms authentication but it failed on Windows authentication