Wednesday, 5 February 2025

PDF installation Steps

 

 PDF installation Steps:

  1. Open Add Remove Programs
  2. Uninstall PDF if present
  3. Take a full backup of Registry
  4. Open Registry with Administrator permission
  5. Remove entry of WebSupergo from HKEY_LOCAL_MACHINE -> Software -> WebSupergoo
  6. Remove entry of WebSupergo from HKEY_LOCAL_MACHINE -> Software -> WOW6432Node -> WebSupergoo
  7. Stop and Start the IIS Application Pool
  8. Install PDF Setup available in exe file
  9. Stop and Start the IIS Application Pool

Wednesday, 26 June 2024

Find Table definition SQL

 SELECT

COLUMN_NAME, DATA_TYPE,character_maximum_length 

FROM INFORMATION_SCHEMA.COLUMNS 

WHERE 

TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'Table name' 

-----------------------------------------------------

SELECT

    clmns.name +','

    FROM

    sys.tables AS tbl

    INNER JOIN sys.all_columns AS clmns ON clmns.object_id=tbl.object_id

    LEFT OUTER JOIN sys.indexes AS ik ON ik.object_id = clmns.object_id and 1=ik.is_primary_key

    LEFT OUTER JOIN sys.index_columns AS cik ON cik.index_id = ik.index_id and cik.column_id = clmns.column_id and cik.object_id = clmns.object_id and 0 = cik.is_included_column

    where tbl.name = N'Table' AND is_identity != 1

Thursday, 2 May 2024

Text, content, table name search in all store procedure and find out store procedure name

  SELECT DISTINCT

       o.name AS Object_Name,

       o.type_desc

  FROM sys.sql_modules m

       INNER JOIN

       sys.objects o

         ON m.object_id = o.object_id

 WHERE m.definition Like '%AddCookiesLead%';

Monday, 11 March 2024

Read Outlook mail c sharp .net C# Azure Active Directory

 using Microsoft.Exchange.WebServices.Data;

using MailKit;

using MailKit.Net.Imap;

using MailKit.Search;

using MailKit.Security;

using Microsoft.Identity.Client;

using Microsoft.Win32.SafeHandles;

using MimeKit;

using Newtonsoft.Json;

using Newtonsoft.Json.Linq;

using System;

using System.Collections.Generic;

using System.Configuration;

using System.Data;

using System.Data.SqlClient;

using System.IO;

using System.Linq;

using System.Net;

using System.Net.Http;

using System.Net.Http.Headers;

using System.Net.Mail;

using System.Runtime.InteropServices;

using System.Security.Authentication;

using System.Text;

using System.Text.RegularExpressions;

using System.Threading;

using System.Threading.Tasks;

using System.Windows.Forms;


namespace PopClient

{

    static class Program

    {

        #region SASMechanism Variables

        static readonly string tenant = "tenant";

        static readonly string smtp_server = "smtp.office365.com";

        static readonly string aad_app_id = "aad_app_id";

        static readonly string aad_app_secret = "aad_app_secret";

        static readonly string user = "user";

        static readonly string pass = "pass";

        static readonly string imap_server = "outlook.office365.com";

        #endregion

        const string ExchangeAccount = "pass";

        /// <summary>

        /// The main entry point for the application.

        /// </summary>

        static void Main()

        {

            #region SecurityProtocolType  Setting 

            try

            { //try TLS 1.3

                ServicePointManager.SecurityProtocol = (SecurityProtocolType)12288

                                                     | (SecurityProtocolType)3072

                                                     | (SecurityProtocolType)768

                                                     | SecurityProtocolType.Tls;

            }

            catch (NotSupportedException)

            {

                try

                { //try TLS 1.2

                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072

                                                         | (SecurityProtocolType)768

                                                         | SecurityProtocolType.Tls;

                }

                catch (NotSupportedException)

                {

                    try

                    { //try TLS 1.1

                        ServicePointManager.SecurityProtocol = (SecurityProtocolType)768

                                                             | SecurityProtocolType.Tls;

                    }

                    catch (NotSupportedException)

                    { //TLS 1.0

                        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

                    }

                }

            }

            #endregion        

            MainAsync().GetAwaiter().GetResult();

            Console.ReadLine();

        }

        static async System.Threading.Tasks.Task MainAsync()

        {

                       var cca = ConfidentialClientApplicationBuilder

                .Create(aad_app_id)

                .WithClientSecret(aad_app_secret)

                .WithTenantId(tenant)

                .Build();


            var ewsScopes = new string[] { "https://outlook.office365.com/.default" };

            try

            {

                var authResult = await cca.AcquireTokenForClient(ewsScopes)

                    .ExecuteAsync();


                // Configure the ExchangeService with the access token

                var ewsClient = new ExchangeService();

                ewsClient.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");

                ewsClient.Credentials = new OAuthCredentials(authResult.AccessToken);

                ewsClient.ImpersonatedUserId =

                    new ImpersonatedUserId(ConnectingIdType.SmtpAddress, user);


                //Include x-anchormailbox header

                ewsClient.HttpHeaders.Add("X-AnchorMailbox", user);


                // Make an EWS call

                // Read 100 mails

                foreach (EmailMessage email in ewsClient.FindItems(WellKnownFolderName.Inbox, new ItemView(10)))

                {

                    string strFrom = "", ToRecipients = "", BccRecipients = "", CcRecipients = "", Subject = "", Body = "", TextBody = "", Attachments = "";

                    //email.Load(new PropertySet(EmailMessageSchema.ConversationTopic, ItemSchema.Attachments,

                    // ItemSchema.TextBody));

                    PropertySet plainTextPropertySet = new PropertySet(BasePropertySet.FirstClassProperties)

                    { RequestedBodyType = BodyType.Text, };

                    EmailMessage emailMessage = EmailMessage.Bind(ewsClient, email.Id, plainTextPropertySet);

                    string body = emailMessage.Body.Text;

                    email.IsRead = true;

                    email.Update(ConflictResolutionMode.AutoResolve);


                    strFrom = email.From.Address;

                    Console.WriteLine(email.ConversationTopic);

                    Console.WriteLine("From : " + strFrom);

                    Console.WriteLine("To : " + email.ToRecipients.ToString());

                    Console.WriteLine("BCC : " + email.BccRecipients);

                    Console.WriteLine("CC : " + email.CcRecipients);


                    Console.WriteLine("Subject : " + email.Subject);

                    EmailMessage message = EmailMessage.Bind(ewsClient, new ItemId(email.Id.ToString()));

                    if (message.HasAttachments && message.Attachments[0] is FileAttachment)

                    {

                        FileAttachment fileAttachment = message.Attachments[0] as FileAttachment;

                        fileAttachment.Load(@"C:\PRAMOD\PROJECT\ReadMailOutlook\PopClient\PopClient\\Attachments\\" + fileAttachment.Name);

                       // lblAttach.Text = "Attachment Downloaded : " + fileAttachment.Name;

                    }

                     }

 }

            catch (MsalException ex)

            {

                Console.WriteLine($"Error acquiring access token: {ex}");

            }

            catch (Exception ex)

            {

                Console.WriteLine($"Error: {ex}");

            }


            if (System.Diagnostics.Debugger.IsAttached)

            {

                Console.WriteLine("Hit any key to exit...");

                Console.ReadLine();

            }

        }


    public class MailMessages

    {

        public MimeMessage mMessage { get; set; }

        public IMailFolder imFolder { get; set; }

        public UniqueId uid { get; set; }

    }

}


Thursday, 8 February 2024

SecurityProtocolType TLS use in code without error for - Tls11, Tls12, and Tls13

 try { //try TLS 1.3

    ServicePointManager.SecurityProtocol = (SecurityProtocolType)12288

                                         | (SecurityProtocolType)3072

                                         | (SecurityProtocolType)768

                                         | SecurityProtocolType.Tls;

} catch (NotSupportedException) {

    try { //try TLS 1.2

        ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072

                                             | (SecurityProtocolType)768

                                             | SecurityProtocolType.Tls;

    } catch (NotSupportedException) {

        try { //try TLS 1.1

            ServicePointManager.SecurityProtocol = (SecurityProtocolType)768

                                                 | SecurityProtocolType.Tls;

        } catch (NotSupportedException) { //TLS 1.0

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

        }

    }

}


Thursday, 10 November 2022

get Tiny URL

 public static string getTinyURL(string url_)

    {

        string retVal = "";

        try

        {


            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://tinyurl.com/api-create.php?url=" + url_);

            if (HttpContext.Current.Request.Url.Authority.Trim().ToLower().Contains("".Trim().ToLower()) || HttpContext.Current.Request.Url.Authority.Trim().ToLower().Contains("localhost".Trim().ToLower()))

            { }

            else

            {

                WebProxy myproxy = new WebProxy("", 8080);

                myproxy.BypassProxyOnLocal = false;

                request.Proxy = myproxy;

            }

            request.Method = "GET";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            StreamReader srd = new StreamReader(response.GetResponseStream());

            retVal = srd.ReadToEnd();

        }

        catch (Exception ex)

        {

            

        }


        return retVal;

    } 


Get Convert DateTime

 public DateTime GetConvertDateTime(string Date)

    {

        DateTime date = new DateTime();

        string CurrentPattern = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;

        string[] Split = new string[] { "-", "/", @"\", "." };

        string[] Patternvalue = CurrentPattern.Split(Split, StringSplitOptions.None);

        string[] DateSplit = Date.Split(Split, StringSplitOptions.None);

        string NewDate = "";

        try

        {

            NewDate = DateSplit[0] + "/" + DateSplit[1] + "/" + DateSplit[2];


            date = DateTime.Parse(NewDate, Thread.CurrentThread.CurrentCulture);


        }

        catch (Exception ex)

        {

            NewDate = DateSplit[1] + "/" + DateSplit[0] + "/" + DateSplit[2];


            date = DateTime.Parse(NewDate, Thread.CurrentThread.CurrentCulture);

        }

        finally

        {


        }


        return date;


    }






 Create Google SMTP App password and use  those password for mail send

Create password URL: 

https://myaccount.google.com/security

https://myaccount.google.com/apppasswords

https://myaccount.google.com/u/0/apppasswords

Thursday, 25 March 2021

VAPT

<meta http-equiv="Content-Security-Policy" content="default-src 'self' * 'unsafe-inline'; child-src *; object-src *; frame-src *; script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline'; font-src *">

 -----------

 void Application_PreSendRequestHeaders(object sender, EventArgs e)

    {

        HttpContext.Current.Response.Headers.Remove("Server");

        Response.Headers.Set("Server", "My httpd server");


        HttpContext.Current.Response.Headers.Remove("X-AspNet-Version");

        Response.Headers.Set("X-AspNet-Version", "XXX");


        HttpContext.Current.Response.Headers.Remove("X-AspNetMvc-Version");

        Response.Headers.Set("X-AspNetMvc-Version", "XXX");


        HttpContext.Current.Response.Headers.Remove("X-Powered-By");

        Response.Headers.Set("X-Powered-By", "XXX");  

    }



https://portswigger.net/research/exploiting-cors-misconfigurations-for-bitcoins-and-bounties

https://portswigger.net/web-security/cors


Access-Control-Allow-Origin: https://www.drreddys.com/

Access-Control-Allow-Credentials: true

-------------

Cookies HttpOnly 

<add name="strict-transport-security" value="max-age=31536000" />: 

<compilation debug="false" targetFramework="4.7.1" numRecompilesBeforeAppRestart="2000">

--------

<system.webServer>

    <httpProtocol>

      <customHeaders>

        <add name="Cache-Control" value="no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0" />

        <add name="Pragma" value="no-cache" />

        <add name="Expires" value="0" />

<add name="X-Frame-Options" value="deny" />

<add name="X-content-type-options" value="nosniff" />

<add name="strict-transport-security" value="max-age=31536000" />

      </customHeaders>

    </httpProtocol>

    </system.webServer>


1. XPath injection                                     –Pramod -- done

5. Input returned in response (reflected)               –Pramod -- Done

6. Suspicious input transformation (reflected)     –Pramod –Done

7. Cross-domain Referer leakage                               -- Sudha --WIP



$("input[type='checkbox'][name='checkhlprof']:checked").length

$("input[type='checkbox'][name='checkhltermcond']:checked").length



1. XPath injection

WIP


2. SSL certificate

Nitin : please check the SSL certificate


3. Content type incorrectly stated

<add name="X-content-type-options" value="nosniff" />


4. Strict transport security not enforced

I have redirect from http to https 

  <rewrite>

   <rules>

      <rule name="HTTPS Rule behind AWS Elastic Load Balancer Rule" stopProcessing="true">

         <match url="^(.*)$" ignoreCase="false" />

         <conditions>

            <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" />

         </conditions>

         <action type="Redirect" url="https://{SERVER_NAME}{URL}" redirectType="Found" />

      </rule>

   </rules>

</rewrite>



5. Input returned in response (reflected)

WIP



6. Suspicious input transformation (reflected)

Error page Default redirect ot error page thus response is showing "error page" by Umbraco CMS


9. Frameable response (potential Clickjacking)

<add name="X-Frame-Options" value="deny" />sameorigin


10. Cacheable HTTPS response

 <add name="Cache-Control" value="no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0" />

        <add name="Pragma" value="no-cache" />

        <add name="Expires" value="0" />



7. Cross-domain Referer leakage

https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css

https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js


8. Cross-domain script include

https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js


Thursday, 21 January 2021

RSS feed API read and show on your website

 private string ParseRssFile()

{
    XmlDocument rssXmlDoc = new XmlDocument();

    // Load the RSS file from the RSS URL
    rssXmlDoc.Load("http://feeds.feedburner.com/techulator/articles");

    // Parse the Items in the RSS file
    XmlNodeList rssNodes = rssXmlDoc.SelectNodes("rss/channel/item");

    StringBuilder rssContent = new StringBuilder();

    // Iterate through the items in the RSS file
    foreach (XmlNode rssNode in rssNodes)
    {
        XmlNode rssSubNode = rssNode.SelectSingleNode("title");
        string title = rssSubNode != null ? rssSubNode.InnerText : "";
                
        rssSubNode = rssNode.SelectSingleNode("link");
        string link = rssSubNode != null ? rssSubNode.InnerText : "";
                
        rssSubNode = rssNode.SelectSingleNode("description");
        string description = rssSubNode != null ? rssSubNode.InnerText : "";

        rssContent.Append("<a href='" + link + "'>" + title + "</a><br>" + description);
    }

    // Return the string that contain the RSS items
    return rssContent.ToString();
}

Thursday, 12 March 2020

Insert UserIP C sharp


public string getExternalIp()
        {
            try
            {
                string ipAddress;
                ipAddress = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (ipAddress == "" || ipAddress == null)
                {
                    ipAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                }
                return ipAddress;

               
            }
            catch { return null; }
        }

public string getExternalIp()
        {
            try
            {
               
string externalIP;
externalIP = (new System.Net.WebClient()).DownloadString("http://checkip.dyndns.org/");
externalIP = (new System.Text.RegularExpressions.Regex( @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}") ).Matches(externalIP)[0].ToString();
                return externalIP;
            }
            catch { return null; }
        }

string IPAddress =  getExternalIp() ?? HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();

Friday, 30 August 2019

Add Custom property in page property and use in Sitefinity

 public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
            Bootstrapper.Initialized += Bootstrapper_Initialized;
        }

        void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped")
            {
                EventHub.Subscribe<IPagePreRenderCompleteEvent>((x) =>
                {
                    if (!x.PageSiteNode.IsBackend)
                    {
                        var page = x.Page;
                        var siteNode = x.PageSiteNode;
                        if (!string.IsNullOrEmpty(siteNode.Attributes["IndigoPageTitle"]))
                        {
                            page.Header.Title = string.Format("{0}", siteNode.Attributes["IndigoPageTitle"]);
                        }
                    }
                });
            }
        }
}
----------------------------------------------
Register your custom property as per below step 




Add meta to sitefinity website site

------Register user control and use below code for meta data--------

-----------------xml file

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<meta-data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<url>
    <newurl value="nav-dividends/nav-dividends">
      <meta>
        <mAttributes>property</mAttributes>
        <mAttributesContent>mAttributesContent</mAttributesContent>
        <mContent>twitterCreator</mContent>
      </meta>
      <meta>
        <mAttributes>itemprop</mAttributes>
        <mAttributesContent>mAttributesContent</mAttributesContent>
        <mContent>twitterCreator</mContent>
      </meta>
    </newurl>
    <oldurl>http://localhost:60878/navs-dividends/nav-dividends</oldurl>
  </url>
</meta-data>
----------------------
try
            {
                string myurl = Request.Url.ToString().ToLower().Trim();
                string BrowseFileDomainName = ConfigurationManager.AppSettings["RootURL"].ToString();
                DataSet listofpage = new DataSet();
                listofpage.ReadXml(Server.MapPath(ConfigurationManager.AppSettings["pagemeta"].ToString()));
                myurl = HttpUtility.UrlDecode(myurl);

                if (BrowseFileDomainName.Contains(";"))
                {
                    string[] domainstr = BrowseFileDomainName.Split(';');
                    if (domainstr.Length > 0)
                    {
                        foreach (string strdomain1 in domainstr)
                        { //To Replace last forward slash from request string
                            myurl = myurl.Replace(strdomain1, "");
                        }
                    }
                }
                else
                {
                    myurl = myurl.Replace(BrowseFileDomainName, "");
                }
                if (myurl.Contains("/"))
                {
                    myurl = (myurl.Substring(myurl.Length - 1, 1) == "/") ? myurl.Substring(0, myurl.Length - 1) : myurl;
                }
                //BrowseFileDomainName = (BrowseFileDomainName.Substring(BrowseFileDomainName.Length - 1, 1) == "/") ? BrowseFileDomainName.Substring(0, BrowseFileDomainName.Length - 1) : BrowseFileDomainName;


                if (myurl.Trim() == "")
                {
                    myurl = "home";
                }
                //   Response.Write("myurl" + myurl);
                if (listofpage.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in listofpage.Tables[0].Rows)
                    {
                        if (listofpage.Tables[1].Rows.Count > 0)
                        {
                            foreach (DataRow dr1 in listofpage.Tables[1].Rows)
                            {
                                if (dr["url_id"].ToString().Trim().ToLower() == dr1["url_id"].ToString().Trim().ToLower())
                                {
                                    if (myurl.Equals(dr1["value"].ToString().Trim().ToLower()))
                                    {
                                        if (listofpage.Tables[2].Rows.Count > 0)
                                        {
                                            foreach (DataRow dr2 in listofpage.Tables[2].Rows)
                                            {
                                                try
                                                {
                                                    if (dr1["newurl_id"].ToString().Trim().ToLower() == dr2["newurl_id"].ToString().Trim().ToLower())
                                                    {
                                                        var page5 = (System.Web.UI.Page)Telerik.Sitefinity.Services.SystemManager.CurrentHttpContext.CurrentHandler;
                                                        var creatorMetaTag = new System.Web.UI.HtmlControls.HtmlMeta();
                                                        creatorMetaTag.Attributes[dr2["mAttributes"].ToString().Trim().ToLower()] = dr2["mAttributesContent"].ToString().Trim();
                                                        creatorMetaTag.Content = dr2["mContent"].ToString().Trim();
                                                        page5.Header.Controls.Add(creatorMetaTag);
                                                    }
                                                    // page5.Header.InnerHtml = "<meta " + dr2["mAttributes"].ToString().Trim().ToLower() + "=\"" + dr2["mAttributesContent"].ToString().Trim() + "\" Content=\"" + dr2["mContent"].ToString().Trim() + "\"/>";
                                                }
                                                catch (Exception ex)
                                                {
                                                 
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                    }
                }
            }
            catch (Exception ex)
            {
             
            }


Wednesday, 31 July 2019

Sitefinity error: ContentView control is in Master mode and no MasterViews exist in the Views collection defined by this control.

Error: ContentView control is in Master mode and no MasterViews exist in the Views collection             defined by this control.

Solution:  Restart the IIS

Monday, 13 May 2019

Delete functionality in sitefinity telerik:RadGrid

 <telerik:RadGrid>
 <MasterTableView DataKeyNames="ID,CategoryName,ParentCategoryID">
                <Columns>
    <telerik:GridTemplateColumn UniqueName="edit">
                        <ItemTemplate>
                             <asp:LinkButton ID="delete_LinkButton" runat="server" Text="delete" CommandName="delete"
CommandArgument='<%# Eval("ID")+";" + Eval("CategoryName") %>' OnCommand="delete_LinkButton_Click"></asp:LinkButton>
                             </ItemTemplate>
                    </telerik:GridTemplateColumn>
  </Columns>
            </MasterTableView>
  </telerik:RadGrid>
 protected void delete_LinkButton_Click(object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "delete")
                {
                    if (e.CommandArgument.ToString().Contains(";"))
                    {
                        string info = e.CommandArgument.ToString();
                        string[] arg = new string[2];
                        char[] splitter = { ';' };
                        arg = info.Split(splitter);


                        int Cat_Id = Convert.ToInt16(arg[0]);
                        string Cat_Name = arg[1].ToString();


                        operation = "D";
                        int exists = CategoryManager.DeleteCategory(operation, Cat_Id, Cat_Name, null);
                        //int exists = 1;
                        if (exists == 1)
                        {
                            strDelMsg = "Deleted successfully!";
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SavedSuccess", "alert('" + strDelMsg + "');", true);
                            BindSchemeCategories();
                        }

                        else
                        {
                            strDelMsg = "This record cannot be deleted as it is mapped!";
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SavedSuccess", "alert('" + strDelMsg + "');", true);

                        }
                    }
                    else
                    {
                        strDelMsg = "This record cannot be deleted as it is mapped!";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SavedSuccess", "alert('" + strDelMsg + "');", true);

                    }
                }
            }
            catch (Exception ex)
            {

             
            }
        }

Tuesday, 2 April 2019

user control use in sitefinity and button submit time dropdown is reset with empty

Refrence: https://docs.telerik.com/devtools/aspnet-ajax/controls/ajaxmanager/how-to/load-user-controls

protected void Page_Load(object sender, EventArgs e)
        {
            //-----pramod
            if (this.CurrentControl != string.Empty)
            {
                LoadMyUserControl(CurrentControl, this.Page);
            }
}


protected void Page_Init(object sender, EventArgs e)
        {
           FunBindCategory();
        }

    private string CurrentControl
        {
            get
            {
                return this.ViewState["CurrentControl"] == null ? string.Empty : (string)this.ViewState["CurrentControl"];
            }
            set
            {
                this.ViewState["CurrentControl"] = value;
            }
        }
        private void LoadMyUserControl(string controlName, Control parent)
        {
            parent.Controls.Clear();
            UserControl MyControl = (UserControl)LoadControl(controlName);
            string userControlID = controlName.Split('.')[0];
            MyControl.ID = userControlID.Replace("/", "").Replace("~", "");
            parent.Controls.Add(MyControl);
            this.CurrentControl = controlName;
        }

protected void btnSubmit_Click(object sender, EventArgs e)
        {
           
                this.LoadMyUserControl("~/UserControls/BackendModule/SchemeCategory Master/ucSchemeCategory.ascx", this.Page);
string test= drpcategory.SelectedValue;

}

Monday, 25 March 2019

.NET Framework 4.7.1 or a later update is already installed on this computer.

Error: .NET Framework 4.7.1 or a later update is already installed on this computer.



Solution: Repair your Visual Studio with below Step

Step 1


Step 2




Thursday, 28 February 2019

Custom Field add in Umbraco CMS

This is folder structure
\App_Plugins\ChannelSelection
channelselection.controller.js
channelselection.html
package.manifest

file contain
------------channelselection.controller.js--------------------
angular.module("umbraco")
    .controller("My.ChannelSelectionController",
    function ($scope) {
        $.ajax({
            url: "/umbraco/api/Portfolio/GetDropdownList",
            dataType: "json",
            type: "GET",
            error: function () {
                //alert(" An error occurred.");
            },
            success: function (data) {
                console.log(JSON.stringify(data));
                $('#fillvalues').find("option").remove();
                var option = $("<option/>");
               // option.attr("value", "").text("Select Channel");
                $("#fillvalues").append(option);
             
                $.each(data, function (i, product) {

                    $.each(product.Channel, function (j, productj) {

                        option = $("<option/>");
                        option.attr("value", productj.Id).text(productj.Name);
                        $("#fillvalues").append(option);
                       // contentc += '    <li><a href="' + productj.link + '"><img src="' + productj.Image + '" alt="' + productj.Name + '" /></a></li>';

                    });
                });
                $('#fillvalues').val($scope.model.value);
            }
        });
        //alert('Control loaded');
    });

--------------------channelselection.html-------------
<div ng-controller="My.ChannelSelectionController">
    <select id="fillvalues"  ng-model="model.value"></select>
 
</div>
--------------------package.manifest---------------
{  
    //you can define multiple editors  
    propertyEditors: [    
        {
            /*this must be a unique alias*/
            alias: "My.ChannelSelection",
            /*the name*/
            name: "Channel Selection",
            /*the html file we will load for the editor*/
            editor: {
                view: "~/App_Plugins/ChannelSelection/channelselection.html"
            }
        }
    ]
    ,
    //array of files we want to inject into the application on app_start
    javascript: [
        '~/App_Plugins/ChannelSelection/channelselection.controller.js'
    ]
}