27 Temmuz 2011 Çarşamba

User Control İçinden fırlatılan Event'i Sayfa içerisinden Yakalamak. (user control aspx event catch)

User Control

 

public partial class LokasyonUserControl :  System.Web.UI.UserControl

 

    {

        public event System.EventHandler SelectedItemDegisti;

 

        protected void LokasyonTipiRComboBox_SelectedIndexChanged(object sender, EventArgs e)

        {

            LokasyonTipiId = Convert.ToInt64(LokasyonTipiRComboBox.SelectedValue);

            if (this.SelectedItemDegisti != null)

                this.SelectedItemDegisti(sender, e);

        }

}

 

User Control Kullanan Sayfa

 

protected override void OnInit(EventArgs e)

        {

            LokasyonUserControl.AutoPostBack = true;

            LokasyonUserControl.SelectedItemDegisti += new EventHandler(LokasyonUserControlTarifeTipiDegistigindeYapilacakIsler);

           

        }

 

        protected void LokasyonUserControlTarifeTipiDegistigindeYapilacakIsler(object sender, EventArgs e)

        {

            //((Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)(e)).Value 'nün içinde LokasyonId 7 olarak geliyor. Bu da kullanılabilir.

            if (LokasyonUserControl.LokasyonTipiId.ToString() == ((long)Distributable.Enumerations.EIMISEnum.LokasyonTipi.IcKonteynerMerkezi).ToString())

            {

                RejimRRadioButtonList.SelectedIndex = 0;

                RejimRRadioButtonList.Enabled = false;

            }

            else

            {

                RejimRRadioButtonList.Enabled = true;

            }

        }

 

Yakalan Event de çağırılan metod, sayfada bir kontrolün görselliği ile ilgili bir değişiklik yapıyorsa, User control ve görselliği etkilenen kontrol ajax kontrolü içine alınmalıdır.

 

<asp:Content ID="Content1" ContentPlaceHolderID="AjaxContent" runat="server">

    <telerik:RadAjaxManagerProxy ID="TanımlamaRadAjaxManagerProxy" runat="server">

        <AjaxSettings>

            <telerik:AjaxSetting AjaxControlID="LokasyonUserControl">

                <UpdatedControls>

                    <telerik:AjaxUpdatedControl ControlID="LokasyonUserControl" />

                    <telerik:AjaxUpdatedControl ControlID="RejimRRadioButtonList" />

                </UpdatedControls>

            </telerik:AjaxSetting>

            </AjaxSettings>

    </telerik:RadAjaxManagerProxy>

</asp:Content>

 

 

25 Temmuz 2011 Pazartesi

Etki alanı (Domain) içinde Giriş Yapılmış Kullanıcı Adını ve Etki Alanı Adını Elde Etmek / How to get current user name and domain name

if (!Page.IsPostBack)

{

string windowsIdentityName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

string[] domainVeKullanici = windowsIdentityName.Split('\\');

windowsIdentityName = domainVeKullanici[domainVeKullanici.Length - 1];

       if (windowsIdentityName == "turbo.sadik")

       {

                        KullaniciAdTextBox.Text = "tsadik@domain.com";

                        PwdTextBox.Text = "sadik123";

                        LoginButton_Click(sender, e);

       }

}

 

15 Temmuz 2011 Cuma

wcf servisi ( WcfSvcHost ) / LLBLGenPro 64 Bit Problem - wcf service ( WcfSvcHost ) / LLBLGenPro 64 bit problem workaround

64 bit bilgisayarlarda wcf projesi yapiyorsaniz, wcfsvchost.exe kullanarak wcf servisini host ediyorsaniz, 32bit derlenmis dll lerin kullaniminda sıkıntı yasayabilirsiniz.

Sorun MS’un bir bug’indan kaynaklaniyor. Uygulama 32 bit calissa bile host.exe yi 64 bit calistiriyor. Workaround var. Corflags.exe kullanilarak wcfsvchost.exe ye her zaman 32 bit calis denilebiliyor.

 

İlgili linkler asagida:

https://connect.microsoft.com/VisualStudio/feedback/details/349510/vs2008-incorrectly-launches-x64-version-of-wcfsvchost-for-x86-debugging

 

http://controlflow.info/?p=9

 

 

Clint Side Error / İstemciden Gelen Hata

The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

 

Server Side Error / Wcf Servisten Gelen Hata

Could not load file or assembly 'Oracle.DataAccess, Version=2.112.1.2, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

 

Solution  / Çözüm

 

(WcfSvcHost.exe)

Open -> Visual Studio 2010 Command Prompt, (Run As Administrator)

 

Cd \

Cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE

corflags /32BIT+ /FORCE WcfSvcHost.exe

 

corflags : warning CF011 : The specified file is strong name signed.  Using /For

ce will invalidate the signature of this image and will require the assembly to

be resigned.

 

(LLBLGenPro.exe)

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>corflags /32BIT+ /FORCE "

C:\Program Files (x86)\Solutions Design\LLBLGen Pro v2.6\LLBLGenPro.exe"

 

Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.1

Copyright (c) Microsoft Corporation.  All rights reserved.

 

corflags : warning CF011 : The specified file is strong name signed.  Using /For

ce will invalidate the signature of this image and will require the assembly to

be resigned.

 

Bu warning’i aldıysanız her şey yolunda demektir. /32BIT- yazarak komutu tekrar çalıştırdığınız 64 bit moda geri dönebilirsiniz.