asp.net

Switch URL to Youtube video, Switch URL to Hyperlink using c#

02 July 2011 |

a friend of mine (who is not a developer) has told me that facebook is somehow affiliated with youtube and his reason was that if you type a video URL in the post box in facebook it automatically appears as video it took me 10 minutes to build this demo, this demo takes a block of text “post text ” which presumably includes a youtube URL and turns it into a youtube video in a webpage   1: private const string FIND_URL_REGEX = "http://([\\w+?\\.\\w+])+([a-zA-Z0-9\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)_\\-\\=\\+\\\\\\/\\?\\.\\:\\;\\'\\,]*)?"; ...

json serialization in ajax net both client side and server side

14 April 2009 |

JSON objects representations are small and lightweight compared to XML they are now the core of AJAX.net services serialization. in AJAX.net they work out of the box you can serilaize/deserialize  your objects to JSON using this snippet of server side code using System.Web.Script.Serialization; JavaScriptSerializer jss = new JavaScriptSerializer(); //Serialize jss.Serialize(object); //Deserialize yourCustomType result = jss.Deserialize(yourJSONString);   and on the client side you can do the same as long as you have a script manager in your page // Serialization var jsonString= Sys.Serialization.JavaScriptSerializer.serialize(JSObject); //deserialization var JSObject= Sys.Serialization.JavaScriptSerializer.deserialize(jsonString);

enumerate app settings

04 December 2007 |

well sometimes you just need to enumerate all of the keys in your appsettings section in web.config this is how it's done 1: foreach (string str in WebConfigurationManager.AppSettings.AllKeys) 2: { 3: Response.Write(string.Format("Key : {0},Value {1}", 4: str, WebConfigurationManager.AppSettings[str])); 5: }

sql profiler custom filter

23 November 2007 |

the tip is simple u need to make a filter that filters and shows only your DB transactions on a server. what u need to do is to change your web.config by adding a string that you can later filter on 1:     now that you have something to distinct your connection from all other users all you have to do is open the profiler window and start a new trace ==> connect don't start the trace yet   and...

override iis maximum upload size max upload size in asp net

17 November 2007 |

by default IIS enables you to upload 2 megabytes and i couldn't seem to figure out how to change that using Internet service manager snap in but i found this on msdn and it's working perfectly fine alll you have to do is add this node right under section in web.config 1: and i managed to upload quite large files.

a potentially dangerous request form value was detected from the client

17 November 2007 |

by default asp.net checks for the scripts in requests so that if it finds a user that is posting javascript or HTML in a request body it will throw an exception "A potentially dangerous Request.Form value was detected from the client" but sometimes you need this like when you allow a user to send HTML formatted block like in an article or if you are building a blog engine and u need to enable the user to add affiliation site codes or a google analytics block in this case all you have to do is to modify your...

are you sure prompt user validation

17 November 2007 |

there's so many times when you need to ask a user "are you sure?" but you want it to be quick and painless you don't want to do one more server round trip just for that you can always use this the javascript prompt function so confirm() but how to integrate that into your asp.net code ok. 1: that's ur button now u need some preparation to the page go to your head tag and add a 1:

amirAmir Magdy

A .net developer since 1.0 Beta but i still like to experience other tech.
Now I am Principal Software Engineer @ITWorx



Recent Posts

Recent Comments

Blog Stats

  • Posts : 73
  • Comments : 166
  • Trackbacks : 0



Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.