Friday, June 15, 2012

File Not Found Error on SharePoint 2010

DB permission issue While Creating Web Application using PowerShell

Scripts that I have tested.
Write-Host ">>>>>>>>>>Process Started>>>>>>>>>>>>>>"
Write-Host ""
New-SPWebApplication -Name "Test" -Port 80 -HostHeader "Test-d" -Path "C:\inetpub\wwwroot\wss\VirtualDirectories\Test-d80" -AuthenticationMethod "NTLM"  -SecureSocketsLayer:$false -ApplicationPool "Test" -URL "http://Test-d/" -ApplicationPoolAccount (Get-SPManagedAccount "Server\Administrator") -DatabaseServer "ServerName" -DatabaseName "test-d"
Write-Host ""
Write-Host ">>>>>>>>>>Process Ended>>>>>>>>>>>>>>"
Note:
This is DB permission issue for the user account Server\Administrator. Kindly check it, the user which you had used here have DB access rights both read and write permission on ServerName DB Server.

Monday, July 04, 2011

The file '/_controltemplates/Usercontrol.ascx' does not exist

You will get this error when you implement CAS(Code Access Security) in SharePoint.To resolve this issue just add/update trust level from "Custom" to "Full".Thats it.
 trust level="Full" originUrl="" />
<

Tuesday, May 10, 2011

The server sent a response which SharePoint Designer could not parse

This error occours, when you open the default.master page using SharePoint Designer 2007, then the problem would be in your web.config file
ie.

The key problem  is  <remove verb="*" path="*.asmx" />. So remove this line and put it next to <remove verb="GET,HEAD,POST" path="*" /> this line.

So, final code should be looks like below one..
All the Best!!!

Friday, April 29, 2011

Sharepoint : Remove 'Pages' text in breadCrumb

This artical help to remove default 'Pages' text in breadcrumb section.

1.Add below javascript code to your sharepoint master page
function breadCrumbs()
 {
  var breadCrumbs = document.getElementById('ctl00_PlaceHolderTitleBreadcrumb_siteMapPathbreadcrumb');
 //alert(breadCrumbs.childNodes.length);
 if (breadCrumbs != null)
 {
  if (breadCrumbs.childNodes.length >= 3)
  {
   var pages = breadCrumbs.childNodes.length-4;
  
   var gt = breadCrumbs.childNodes.length-3;
  
   if (breadCrumbs.childNodes[pages].innerHTML.indexOf('Pages') > 0)
   {
    if (breadCrumbs.childNodes[breadCrumbs.childNodes.length-2].innerText == 'default.aspx')
    {
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-2].style.display= "none";
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-3].style.display= "none";
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-4].style.display= "none";
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-5].style.display= "none";
    }
    else
    {
     breadCrumbs.childNodes[pages].style.display= "none";
     breadCrumbs.childNodes[gt].style.display= "none";
     var str=breadCrumbs.childNodes[pages+2].innerText;
     str=str.replace(".aspx","");
     breadCrumbs.childNodes[breadCrumbs.childNodes.length-2].innerText=str;
    }     
   }
  }
 }
 }
2.Add this function in body of master page like below
  <body class="body" onload="javascript:breadCrumbs();">
3.Save and run

Tuesday, March 15, 2011

CSV File BULK Upload using ASP.NET & SQL

if (CSVFileUpd.HasFile)
{
       string filePath = CSVFileUpd.PostedFile.FileName;
       string filenameStor = CSVFileUpd.FileName;
       string filenameType = System.IO.Path.GetExtension(CSVFileUpd.PostedFile.FileName);
       if (filenameType.ToString().Trim().ToLower() == ".csv")
       {
                System.IO.Stream str = default(System.IO.Stream);
                str = CSVFileUpd.PostedFile.InputStream;
                System.IO.StreamReader sr = new System.IO.StreamReader(str);
                string[] tokens = null;
                 string line = null;
                 // string token = null;
                 //Response.Write("<table>");
                 System.Data.DataTable dt = new System.Data.DataTable("CSVFileData");
                // Define 3 columns
                 System.Data.DataColumn dc;
                 dc = new System.Data.DataColumn("Id");
                dt.Columns.Add(dc);
                dc = new System.Data.DataColumn("Name");
                dt.Columns.Add(dc);
                dc = new System.Data.DataColumn("Prefix");
                dt.Columns.Add(dc);
                do
               {
                  line = sr.ReadLine();
                  if (line == null)
                   break; // TODO: might not be correct. Was : Exit Do
                   if (line == "")
                   {
                      lblMessage.Text = "File content is empty!";
                        break;
                   }
                  //Response.Write("<tr>");
                 tokens = line.Split(',');
                 if (line.Split(',').Length != 3)
                {
                      lblMessage.Text = "Invalid file! File should have 3 columns.";
                      break;
                 }
                if (tokens[0].Length > 0 && tokens[1].Length > 0)
               {
                     dt.Rows.Add(tokens[0], tokens[1], tokens[2]);
                }
              } while (!(line == null));
             // Response.Write("</table>");
            sr.Close();
            lblMessage.Text = CSVFileUpload(dt);
      }
      else
     {
         lblMessage.Text = "Please select .CSV/.csv  file!";
    }

protected string CSVFileUpload(System.Data.DataTable dtCSV)
{
using (System.Data.SqlClient.SqlBulkCopy bulk = new System.Data.SqlClient.SqlBulkCopy("Data Source=LOCALHOST\MSSQLSERVER;Initial Catalog=Reporting_Testing;Integrated Security=True"))
{
try
{
bulk.DestinationTableName = "MyDetails";
bulk.WriteToServer(dtCSV)
return "CSV File uploaded successfully!";
}
catch (Exception ex)
{
return ex.Message.ToString();
}
}
}

Tuesday, March 08, 2011

Error: “Sys” is Undefined Error

This is an javascript error will display in the browser because of some references missing in web.config file of your application and specially when you host your application to the server.
To resolve this please follow the below steps
1. Open the web.config file
2.Copy the below code to inside of


Http handlers are the .NET Components that implement the System.Web.IHttpHandler.
They are similar to ISAPI extensions,but one difference is the Http handles can be called directly by using their file name in the URL.
3.Copy the below code inside of


HTTP modules are .NET components that implements the System.Web.IHttpModule interface.
They are plug into the ASP.NET request processing pipeline by registering themselves for certain events