April 05, 2013

IIS overrides Response.StatusCode and showing default error page instead of custom message in ajax

in asp.net/mvc whenResponse.StatusCode is set, IIS 7.5 by default capture the response and inject default page according to the status code.

My following code was working fine on IIS 6, but as soon as i port this code on 7.5 i started getting following issue.

Response.StatusCode = 404; return new ContentResult { Content = "Not Found"}; 

ajax({type: "POST",url: d,data: f,success: function(h, j) {
g.redirectUrl();
},error: function(j, h) {
b._displayError(j.responseText);
}});

404 - FILE OR DIRECTORY NOT FOUND.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.



It should have shown error message "Not Found" message.

Solution: To avoid IIS to inject default page. Add following into the Web.config of your app.

<system.webServer>
    <httpErrors existingResponse="PassThrough" />
  </system.webServer>

September 08, 2012

The procedure entry point sqlite3_wal_checkpoint could not be located in the dynamic link library SQLite3.dll

Issue:The procedure entry point sqlite3_wal_checkpoint could not be located in the dynamic link library SQLite3.dll.

Description: For Iphone, ipod, ipad you install some applications for internet, data-sharing, video chat, songs sync, or any kind of sync.

all these application depends on itunes in some or other way. when those required files are not located to access iTunes etc. these kind of issue occurs.

in my case it was issue with PdaNet, it is used to access iPhone internet plan on laptop/desktop. very good app indeed.

Resolutions:

1) Ensure Itunes is installed
2) iTunes releated services are running
3) go to C:\Windows\SysWOW64 and check for "sqlite3.dll ", if its there rename it.
4) go to C:\Windows\System32 and check for "sqlite3.dll ", if its there rename it.

Now check you application which was throwing this particular error. it should work.
after that check all application you have installed for IOS devices. make sure every app is working fine.

Let me know via commenting if this work or not, or anybody has resolved it using alternate method.
Do Share it on G+ and facebook.

August 27, 2012

How to search Active directory for email and name of current NT user

You can search for your organisation's Active directory for particular user's email-id, first name, last name and many other vital information using LDAP.

what you need
1) LDAP Address
2) Any valid active directory credentials (e.g yours own)

No need to install any third party software etc.

Code snippet:-

var userWithoutDomainName = "skumar"

var entry = new DirectoryEntry("LDAP://DC=company, DC=com"/>, "username", "password");//username //is without domain
            var searcher = new DirectorySearcher{
                SearchRoot = entry,
                Filter = "(SAMAccountName=" +userWithoutDomainName + ")" };
            searcher.PropertiesToLoad.Add("Mail"); //email-id
            searcher.PropertiesToLoad.Add("givenName");//first name
            searcher.PropertiesToLoad.Add("st");
            searcher.PropertiesToLoad.Add("sn"); //Last name
            return searcher.FindOne(); //.FindAll() is also available, for example if you searching with name only //and there are chances of more than one user

in this way you can search the users from active directory, there are others properties are available to search for, you can google for it, if not found comment below, i will help.

August 26, 2012

Error: Server sent unexpected return value (405 Method Not Allowed)

Problem: Error: Server sent unexpected return value (405 Method Not Allowed)

Problem is while you add new folder to the SVN repository, then commit, above error is thrown.
This was occuring to me because of following Reason.

1) i created a new folder "Raj", then right clicked and from Tortoise Context menu, selected Add.
it showed added.
2) now when i tried to commit, the mentioned issue came.
3) Even it was not allowing me to undo the add, which i did on step1

after spending lot of time, i get to know, somebody in morning Added the folder with same name "Raj" in the repository.

My mistake was, i did not take the latest before adding the new folder.

if you are getting same issue, pls check via going to repo-browser that, Is it because of same reason, which i mentioned.

do comment below,  if it resolve or not resolve you issue.