Site menu:

Links:

RSS .NET RSS

RSS Engadget

Site search

Categories

March 2010
M T W T F S S
« Jan    
1234567
891011121314
15161718192021
22232425262728
293031  

Tags

Blogroll

Tag: ASP.NET

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 [...]

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)
{ [...]

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
{
[...]

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>

Using Transaction Scope on .NET

Basic Requirements:
1. Have the MSDTC(Distributed Transaction Coordinator) windows service running on your machine
2. Be talking to a SQL 2000 or 2005 Database configured likewise
3. Run this registry script to fix the windows XP SP2 that was causing MSDTC to fail (save as “.reg”)
Registry Script

Windows Registry Editor [...]

the server committed a protocol violation section= responsestatusline

I’ve got this error and try to spend almost an hour to resolve this:
“the server committed a protocol violation section= responsestatusline” when I tried to get the response back from the payment gateway. It happens when you send HTTP Request one after another on the same page. The solution is to add unsafeheaderparsing [...]

Invalid postback or call argument

It’s quite often I have this error because of the content has been changed during postback or because of the control id. I’ve read most of the article suggested to disable the event validation by putting this on the page which is loosen up the security of that particular page. I found the other [...]

Create hyperlink column in gridview or datagrid

Sometimes when you display the data on the datagrid or gridview , you want to create some link. let’s say when you displaying your user detail data in the grid. you want the user to be able to click the link in email column that automatically open microsoft outlook for you. You also would like [...]

Error code 0×8013134b when debugging ASP.NET

Auto-attach to process ‘[2440] w3wp.exe’ on machine ‘…’ failed. Error code 0×8013134b. This problem is most likely occurred because I have two .NET framework installed in my PC (v1.14322 and v2.0).
To fix this problem:
• Open IIS (inetmgr)
• Right click on the web site with the problem
• Click the ASP.NET tab
• Change the ASP.NET version from [...]

Iterate by Index in DataTable

This post will explain how to iterate through datatable and how to get value based on index.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
//This function is used to iterate through datatable
private void GetAllRows(DataSet ds){
// iterate through table in the DataSet
get the values of each row.
 
foreach(DataTable currTable in ds.Tables){
// iterate through [...]