Tuesday, 28 February 2012

Add .svc in MIME type IIS7

1. Add application in IIS7
2. Right click+switch to Features view
3. Double Click on MIME type
4. From Actions--->  click Add











5. .svc and application/octetstream + Click OK
OR
(try from your side.)
1.) a. Cd %systemRoot%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
b. ServiceModelReg.exe -i
c. ServiceModelReg.exe -r

Thursday, 5 January 2012

Procedure with output parameter

With the help of Enterprise library:
Solution:

 DbCommand cmdDel = _db.GetStoredProcCommand("USP_YOURPROCEDURE");
                _db.AddOutParameter(cmdDel, "@STATUS", DbType.String, int.MaxValue);
                _db.AddInParameter(cmdDel, "@VID", DbType.Int32, HFVID.Value);
                _db.ExecuteDataSet(cmdDel);
               
                lblStatus.Text = cmdDel.Parameters["@STATUS"].Value.ToString();

A name was started with an invalid character. Error processing resource 'http://localhost/WCF...'


<>The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

A name was started with an invalid character. Error processing resource 'http://localhost/WCFIISService/Service.svc'. Line...
<%@ ServiceHost Service="WCFDefault.Service1" %>

Solution:

IN IIS>Handler Mappings>Add Managed Handlers

Request-path
*.svc

Type:
System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Name
svc-integrated

Friday, 9 December 2011

Opening Outlook with new e-mail from Asp.net

add Outlook reference through com
then include  " using Outlook = Microsoft.Office.Interop.Outlook;  " in header
use the following code for opening outlook with new email

code:

try
        {
            // Create the Outlook application.
            Outlook.Application oApp = new Outlook.Application();

            // Get the NameSpace and Logon information.
            Outlook.NameSpace oNS = oApp.GetNamespace("mapi");

            // Log on by using a dialog box to choose the profile.
            oNS.Logon("Outlook", "", true, true);

            // Alternate logon method that uses a specific profile.
            // TODO: If you use this logon method,
            //  change the profile name to an appropriate value.
            //oNS.Logon("YourValidProfile", Missing.Value, false, true);

            // Create a new mail item.
            Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);

            // Set the subject.
            oMsg.Subject = "Testing";

            // Set HTMLBody.
            String sHtml;
            sHtml = "<HTML>\n" +
               "<HEAD>\n" +
               "<TITLE>Sample GIF</TITLE>\n" +
               "</HEAD>\n" +
               "<BODY><P>\n" +
               "<h1><Font Color=Green>Testing</Font></h1></P>\n" +
               "<P>Testing Testing Testing Testing</P>\n" +
               "<P>Testing Testing Testing Testing</P>\n" +
               "</BODY>\n" +
               "</HTML>";
            oMsg.HTMLBody = sHtml;
          //  oMsg.Attachments.Add(OpenFile(@"C:\MyAttachmentFi.txt"), Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing);
            //try for attachments sorry the above code is not working..
           

            // Add a recipient.
            Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
            // TODO: Change the recipient in the next line if necessary.
            Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("emailid@mail.com");
           
         oRecip.Resolve();
           oMsg.Display(oMsg);  //code for display the outlook
            // Send.
      //    oMsg.Send();    //code for sending

            // Log off.
          oNS.Logoff();

            // Clean up.
            oRecip = null;
            oRecips = null;
            oMsg = null;
            oNS = null;
            oApp = null; 
        }

         // Simple error handling.
        catch (Exception ess)
        {
            Console.WriteLine("{0} Exception caught.", ess);
        } 


screen shot:


Thankyou..:)

Tuesday, 22 November 2011

Remove underline from link button ?

#1 CSS
 .NoUnderLine
   {
      text-decoration: none;
   }
#2 HTML
 <asp:linkbutton id="lnkLogOut" Text="LOGOUT" runat="server" CssClass="NoUnderLine" />

Friday, 11 November 2011

Javascript onBlur function

Desc: When you click on the textbox the value of textbox is cleared by using Javascript
method.
function doEmptytextbox(id, txtVal)
{
         var searchtext = document.getElementById(id).value;
          if (searchtext == txtVal) {
          document.getElementById(id).value = "";
          }
}

function dorestoretextbox(id, txtVal)
{
         var searchtext = document.getElementById(id);

          if (searchtext.value == "") {
          document.getElementById(id).value = txtVal;
          }
}

When TextBox is in Master Page!... code goes like this.

<asp:TextBox ID="txtNcid" runat="server" BackColor="White" ForeColor="Black" Text="(New)/Search"onblur = "return dorestoretextbox('ctl00_MainContent_txtNcid', '(New)/Search');" onclick="return doEmptytextbox('ctl00_MainContent_txtNcid', '(New)/Search');" Font-Bold="true"></asp:TextBox>

Friday, 19 August 2011

How to Retrieve a DLL from the GAC


Step 1. Opend Command prompt
Step 2. Browse for GAC/GAC_32/GAC_MSIL Folder
    (C:\Window\assembly\GAC)
    <image>
Step 3. Each assembly have it own folder. So if you need to access the assembly
            Like eg: CrystalDecisions.Enterprise.Franework
    C:\Window\assembly\GAC>cd CrystalDecisions.Enterprise.Franework
step 4. C:\Window\assembly\GAC\CrystalDecisions.Enterprise.Franework>
    Once in the folder, you should see a subfolder for each version of the assembly in the GAC.
    C:\Window\assembly\GAC\CrystalDecisions.Enterprise.Franework>dir
    you can see sub folders in it like This:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\WINDOWS\assembly\GAC\CrystalDecisions.Enterprise.Framework\10.5.3700.0__692fb
ea5521e1304>dir
 Volume in drive C is TECLAB-4
 Volume Serial Number is 3844-D579

 Directory of C:\WINDOWS\assembly\GAC\CrystalDecisions.Enterprise.Framework\10.5
.3700.0__692fbea5521e1304

04/11/2009  02:47 AM    <DIR>          .
04/11/2009  02:47 AM    <DIR>          ..
04/11/2009  02:47 AM            45,056 CrystalDecisions.Enterprise.Framework.dll

04/11/2009  02:47 AM               229 __AssemblyInfo__.ini
               2 File(s)         45,285 bytes
               2 Dir(s)   5,783,031,808 bytes free
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
step 5. Now copy this dll to your prefred location using COPY or XCOPY Command.

 C:\WINDOWS\assembly\GAC\CrystalDecisions.Enterprise.Framework\10.5.3700.0__692fbea5521e1304>xcopy * \jeevandll
 C:CrystalDecisions.Enterprise.Framework.dll
 C:__AssemblyInfo__.ini
 2 File(s) copied