31 articles ASP.NET Page 2 / 4

PowerPoint Master Slide Font for Nested List

Berikut langkah untuk mengatur font di Master Slide PowerPoint, bagian list Buka Master Slide, block list level 1, klik font Waktu sudah di-ok, ada kemungkinan setting font akan kembali ke asal. Misalnya tadinya 12, diganti ke 8, akan kembali ke 12 lagi. Hal ini sepertinya hanya bug di PowerPoint. Jika kita membuat slide dengan template…

CS0433

CS0433: The type ‘System.Web.Helpers.WebGrid’ exists in both ‘c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Helpers\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.Helpers.dll’ and ‘c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Helpers\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.Helpers.dll’ Solusinya dengan menghapus <add assembly=”System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ /> Dari web.config

Upload Files with HTTPWebRequest and Web API

Contoh kode untuk mengirim file menggunakan HTTPWebReqeust. Jika bukan MVC, dapat meng-add Microsoft.Net.Http pada NuGet. Kode di bagian pengiriman file [code language=”csharp”] public string HttpPost(string url, string fileName, byte[] fileByte, string username) { ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications); HttpContent fileNameContent = new StringContent(fileName); HttpContent usernameContent = new StringContent(username == null ? "" : username); HttpContent fileContent…

ASP.NET Web Forms and MVC Bypass Authorization for Single Form or Single Controller using web.config

Jika penanganan authorization menggunakan web.config, authorization dapat di by pass untuk form tertentu / controller tertentu. “Api/File” adalah url untuk memanggil controller (MVC / Web API). “service/FileService.aspx” adalah struktur folder/file ke form. [code language=”xml”] <configuration> <location path="Api/File"> <system.web> <authorization> <allow users="?"></allow> </authorization> </system.web> </location> <location path="service/FileService.aspx"> <system.web> <authorization> <allow users="?"></allow> </authorization> </system.web> </location> <system.web> <authentication…

DevExpress Upload File

Penanganan upload file seperti di MVC pada webform / devexpress: Semua file disimpan di folder /Uploads/ File diberikan penanda unik dengan GUID [code language=”html”] <dx:LayoutItem Caption="E-corr*" FieldName="attachment" ColSpan="2"> <LayoutItemNestedControlCollection> <dx:LayoutItemNestedControlContainer ID="LayoutItemNestedControlContainer8" runat="server" SupportsDisabledAttribute="True"> <dx:ASPxUploadControl Theme="Metropolis" ID="UploadECorr" Width="20%" ClientInstanceName="UploadECorr" runat="server" UploadMode="Standard" ClientVisible="true" OnFileUploadComplete="UploadECorr_FileUploadComplete"> <AdvancedModeSettings EnableMultiSelect="false" /> <ValidationSettings MaxFileSize="10485760"></ValidationSettings> <ClientSideEvents FilesUploadComplete="onUploadControlFileUploadComplete" /> </dx:ASPxUploadControl> </dx:LayoutItemNestedControlContainer> </LayoutItemNestedControlCollection> </dx:LayoutItem> [/code]…

DevExpress Grid Show Data from One to Many

Kasus: project memiliki relasi one-to-many terhadap history_afe. Pada tabel ingin ditampilkan data status yang merupakan status project terakhir dari tabel history_afe. ASPX [code language=”aspx”] <dx:GridViewDataTextColumn FieldName="Status" VisibleIndex="30" Caption="Status"> <Settings AllowAutoFilter="False" AllowSort="False" /> <DataItemTemplate> <dx:ASPxLabel ID="LastStatus" runat="server" OnInit="LastStatus_Init"></dx:ASPxLabel> </DataItemTemplate> </dx:GridViewDataTextColumn> [/code] C# [code language=”csharp”] protected void LastStatus_Init(object sender, EventArgs e) { DevExpress.Web.ASPxEditors.ASPxLabel label = (DevExpress.Web.ASPxEditors.ASPxLabel)sender; GridViewDataItemTemplateContainer…

Send Email using Gmail with Attachment

Contoh fungsi mengirim email menggunakan Gmail [code language=”csharp”] private void SendDispositionEmail(IncomingDocumentFormStub form) { //kamus var message = new MailMessage(); string body = "<p>Nomor Surat: {0}</p><p>Perihal: {1}</p><p>Melihat detail: {2}</p>"; string link = "<a href=\"{0}\">{1}</a>"; string address = Request.Url.Scheme + "://" + HttpContext.Request.Url.Authority + Url.Action("Detail", "IncomingDocument", new { id = form.Id }); string[] attachmentPathList; //address = HtmlHelper.GenerateLink(this.ControllerContext.RequestContext,…

Visual Studio Debug Access from Other Computer

Assume your machine name is ‘jedi’, and your port number is ’16253′, replace appropriately. 1. Run a command prompt as administrator, and type in netsh http add urlacl url=http://jedi:16253/ user=everyone 2. Open up the following file in Notepad or Visual Studio MyDocuments\IISExpress\config\ applicationhost.config change the binding from: <binding protocol=”http” bindingInformation=”*:16253:localhost” /> to: <binding protocol=”http” bindingInformation=”*:16253:jedi”…