News for the ‘Programming’ Category

Asp.net Error: The Active Directory membership provider has not been configured to support search methods

Solution for the error:
The following message may help in diagnosing the problem: The Active Directory membership provider has not been configured to support search methods.

This error usually displayed when Active directory is choosen to get ASP.net based website members
Just add : enableSearchMethods=”true” in the web.config file as detailed below

<membership defaultProvider="MyADMembershipProvider" >
      <providers>
        <add name="MyADMembershipProvider" enableSearchMethods="true"
        type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, &#xD;&#xA;        PublicKeyToken=b03f5f7f11d50a3a"
        connectionStringName="ADConnectionString"
        attributeMapUsername="sAMAccountName"
        connectionUsername="Domain\UserName"
        connectionPassword="PassWord"/>
      </providers>
    </membership>
Posted: October 29th, 2009
Categories: Asp.net
Tags:
Comments: No Comments.

Asp.net error: Server Error in ‘/’ Application

Server Error in ‘/’ Application
————————————————————

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:

Line 50:             ASP.NET to identify an incoming user. 
Line 51:         -->
Line 52:         <authentication mode="Windows" />
Line 53:         <!--
Line 54:             The <customErrors> section enables configuration

Source File: c:\inetpub\wwwroot\website1\web.config Line: 52
Source File: c:\inetpub\wwwroot\somewhere\web.config Line: 51
Cause

This error is generated because the default set of configuration values in web.config require IIS to treat the web site as an application but this has not been configured.

Solution:
1.Control Panel > Administrative Tools >IIS
2. Open webiste properties (Default Web Site>Your Website >Right click > Properties)
3. If the “application name” (under “Application Settings” on the “Directory” tab) is greyed out then click ‘[Create]‘ and then ‘[OK]‘.

Posted: October 28th, 2009
Categories: Asp.net
Tags:
Comments: No Comments.

.net Regular Expressions String Match Replace

.net Regular Expressions String Match Replace

String Match using regular expressions – VB.net

Import Imports System.Text.RegularExpressions
 
            'regularExpression_Match -> regular expression pattern to macth
            Dim regularExpression_Match As New Regex("(.*)REGULAR EXPRESSION MATCH PATTERN(.*)")
            'txtInput.txt -> Text to macth against regularExpression_Match pattern
            Dim myMatch As Match = System.Text.RegularExpressions.Regex.Match(txtInput.Text, regularExpression_Match)
            If myMatch.Success Then
                'Do Something
            End If</code>
 
<code lang="vbnet[lines]">If Regex.IsMatch( userInputString, "\d+(\.?\d+)" ) Then
    ' perform some conversion and math operations here
End If </code>
 
 
<strong>String Replace using regular expressions - VB.net</strong>
 
<code lang="vbnet">                    Try
                        'regularExpression_Replace -> regular expression pattern to replace
                        Dim regularExpression_Replace As New Regex("(.*)REGULAR EXPRESSION REPLACE PATTERN(.*)")
                        'txtInput.txt -> Text to macth and replace against 
                        Dim txtReplacementPattern As String
                        txtReplacementPattern = "THIS WILL BE MY REPLACED TEXT"
                        'txtReplacementPattern = "$$2 $$1"
                        txtInput.Text = regularExpression_Replace.Replace(txtInput.Text, _
                            txtReplacementPattern)
                    Catch ex As Exception
                        Mess

Regular Expressions in ASP.NET

Posted: July 20th, 2009
Categories: VB.net
Tags: , , ,
Comments: No Comments.

Error: Path for project must have only one segment

Error: Path for project must have only one segment

Even Though google shows 995,000 pages containg the text “Path for project must have only one segment” – None of them really explains what this error mean – Except if you look at the source code of WorkspaceRoot class, particularly ‘getProject’ method:

This problem usually occurs when you try to access a project name/path,etc, when it is not avialable or you might have forget to instantiate the IProject object or try to instantiate the IProject with different name.

Solution: Have a look at your code where you are calling

getProject.

Check names, paths are called correctly.

public IProject getProject(String JavaDoc name) {
      //first check our project cache
 Project result = (Project) projectTable.get(name);
       if (result == null) {
            IPath projectPath = new Path(null, name).makeAbsolute();
          String JavaDoc message = "Path for project must have only one segment."; //$NON-NLS-1$
 Assert.isLegal(projectPath.segmentCount() == ICoreConstants.PROJECT_SEGMENT_LENGTH, message);
            //try to get the project using a canonical name
 String JavaDoc canonicalName = projectPath.lastSegment();
            result = (Project) projectTable.get(canonicalName);
             if (result != null)
                 return result;
            result = new Project(projectPath, workspace);
            projectTable.put(canonicalName, result);
       }
         return result;
     }
Posted: July 9th, 2009
Categories: Java
Tags: ,
Comments: No Comments.