Archive for 'ASP.NET'
Compression in Silverlight Isolated Storage
Isolated storage in silverlight is used to store information or object therefore we don’t need to go to database to get all the information over and over again but again to use isolated storage or not should be based on case by case. Based on the implementation of the code below, I’ve found that it [...]
Posted: December 4th, 2009 under .NET, ASP.NET, VB.NET.
Tags: Isolated Storage, Silverlight
Comments: none
FormsAuthentication.GetRedirectUrl only get the first parameter of querystring
I found the issue with FormsAuthentication.GetRedirectUrl when it redirects then it redirects with the first querystring that you have while in fact you might have more than one querystring
e.g http://localhost/myweb/login.aspx?returnurl=myview.aspx?viewID=123&viewname=abc&viewall=false then the standard FormsAuthentication will redirect to http://localhost/myweb/myview.aspx?viewID=123
but where’s the remaining viewname querystring and viewall querystring??to fix this, just use the code below to pick [...]
Posted: August 7th, 2009 under .NET, ASP.NET, VB.NET.
Tags: ASP.NET, Forms Authentication
Comments: none
an activex control on this page might be unsafe to interact with other parts of the page. do you want to allow this interaction?
I keep getting this message “an activex control on this page might be unsafe to interact with other parts of the page. do you want to allow this interaction” when I try to access a page that use Javascript to access ActiveX Code. I’ve spent quite sometime to get rid of this error message and [...]
Posted: July 3rd, 2009 under .NET, C#, Javascript, VB.NET.
Comments: none
Resolve URL functions
This snippet code is credited to Scott’s Hanselman, This Resolve URL function is used where you want to implement it on your business layer.
Methods:
#region "Image URL helpers"
public static string ResolveUrl(string originalUrl)
{ [...]
Posted: May 31st, 2009 under .NET, ASP.NET, C#.
Tags: ASP.NET, C#, Resolve URL methods
Comments: none
Upload Multiple Files to FTP in .NET
I’ve played around with FTP couple of weeks back. My application is required to feed FTP folder with 1000+ files daily. I’ve been googling around and I found one of the methods is to use WebApplication so I decided to put this WebApplication method to upload while iterating every single files in the directory. After 5 files, [...]
Posted: May 24th, 2009 under .NET, ASP.NET, C#, VB.NET.
Tags: Asynchronous Upload, The remote server returned an error: (503) Bad sequence of commands, Upload Files to FTP
Comments: none
SQL Server Function using CLR
UPDATED: I’ve added one function to write from BLOB in SQL Server table to the disk straight away
I thought this article might be useful for anyone that wants to implement .NET code to SQL server level. In this case I really need CLR because I want to do compression of images and I believe it’s [...]
Posted: October 9th, 2008 under .NET, C#, SQL Server.
Tags: .NET, SQL Server, TSQL
Comments: 2
Linq.Binary(SQL Image Data Type) Type to File Stream
I got a column with Data Type of Image in SQL Server. What I would like to do is to omit this data to a FileStream or to a file. I tried to read the data using LINQ and I found the data type detected for that particular column is System.Data.Linq.Binary. I was expecting it [...]
Posted: October 3rd, 2008 under .NET, C#, SQL Server.
Tags: .NET, LINQ, SQL Server
Comments: none
SQL Methods in LINQ
I’m trying to implement DateDiff in LINQ. I would like to get all records with the same date and ignoring the timestamp.
Here is my code snippet which doesn’t work
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public int tblExpReceiptFileUniqueID(string chCreateStaffCode, string vcFileName,
[...]
Posted: October 2nd, 2008 under .NET, C#, SQL Server.
Tags: LINQ, SQL Server
Comments: none
Convert DataTable to CSV Function
This is the class that you can use to create a CSV file from DataTable. Basically what it does is to iterate each column and row in datatable and separate them with comma.
Class/Function:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Data;
using System.IO;
using System.Text;
using System.Web;
namespace BusinessLayer
{
public class CSVBuilder
{
[...]
Posted: September 3rd, 2008 under .NET, ASP.NET, C#.
Tags: ASP.NET, C#
Comments: none
overriding maximum file upload size in ASP.NET
To override maximum file size that can be uploaded in you website, you need to put this in your web.config
1
2
3
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="4096" />
</system.web>
Posted: September 1st, 2008 under ASP.NET.
Tags: ASP.NET
Comments: none