background preloader

URL Encoding

URL Encoding
RFC 1738: Uniform Resource Locators (URL) specification The specification for URLs (RFC 1738, Dec. '94) poses a problem, in that it limits the use of allowed characters in URLs to only a limited subset of the US-ASCII character set: "...Only alphanumerics [0-9a-zA-Z], the special characters "$-_.+! HTML, on the other hand, allows the entire range of the ISO-8859-1 (ISO-Latin) character set to be used in documents - and HTML4 expands the allowable range to include all of the Unicode character set as well. URLs should be encoded everywhere in an HTML document that a URL is referenced to import an object (A, APPLET, AREA, BASE, BGSOUND, BODY, EMBED, FORM, FRAME, IFRAME, ILAYER, IMG, ISINDEX, INPUT, LAYER, LINK, OBJECT, SCRIPT, SOUND, TABLE, TD, TH, and TR elements.) What characters need to be encoded and why? How are characters URL encoded? Example Space = decimal code point 32 in the ISO-Latin set. 32 decimal = 20 in hexadecimal The URL encoded representation will be "%20" URL encoding converter

?: Operator (C# Reference) The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. Following is the syntax for the conditional operator. condition ? first_expression : second_expression; The condition must evaluate to true or false. Either the type of first_expression and second_expression must be the same, or an implicit conversion must exist from one type to the other. You can express calculations that might otherwise require an if-else construction more concisely by using the conditional operator. int input = Convert.ToInt32(Console.ReadLine()); string classify; // if-else construction. if (input > 0) classify = "positive"; else classify = "negative"; // ? The conditional operator is right-associative. The conditional operator cannot be overloaded. Reference Concepts Other Resources

Making Sense of ASP.NET Paths ASP.Net includes quite a plethora of properties to retrieve path information about the current request, control and application. There's a ton of information available about paths on the Request object, some of it appearing to overlap and some of it buried several levels down, and it can be confusing to find just the right path that you are looking for. To keep things straight I thought it a good idea to summarize the path options along with descriptions and example paths. I wrote a post about this a long time ago in 2004 and I find myself frequently going back to that page to quickly figure out which path I’m looking for in processing the current URL. Apparently a lot of people must be doing the same, because the original post is the second most visited even to this date on this blog to the tune of nearly 500 hits per day. So, I decided to update and expand a bit on the original post with a little more information and clarification based on the original comments. What else?

The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. « Welcome to ShanthaKumar’s Blog Posted by: Shantham | March 9, 2009 The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. The above error will be thrown at the time of updating Library or Lists items due to authentication problem, or We didn’t have the rights to update the items. Web.AllowUnsafeUpdates = true; item["Title"]=”Sample”; item.Update(); or we can also use the follwoing code to overcome the above error, this will affect the WebApplication. web.Site.WebApplication.FormDigestSettings.Enabled = false; item["Title"]=”Sample”; item.Update(); web.Site.WebApplication.FormDigestSettings.Enabled = true; or we can change the settings in Central Administration to anonymously update the items. Central Administration > Application Management > Web Application General SettingsChoose the WebApplication to overwrite the settingsSelect the option Off in Web Page Security Validation as follows, Read more… Like this: Like Loading...

Disposing Objects You can identify the potential presence of incorrectly disposed objects by asking the following questions: Does your application pool recycle frequently, especially under heavy loads (assuming that the application pool is set to recycle when a memory threshold is reached)? The memory threshold should be 800 megabytes (MB) to 1.5 gigabytes (GB), assuming at least 2 GB of RAM. Setting the recycle of the application pool to occur closer to 1 GB gives the best results, but experiment to determine what settings work best for your environment. If the recycle setting is too low, your system experiences performance issues because of frequent application pool recycles. If you answer "yes" to number 4, and to one or more of the other questions, there is a good chance that your custom code is not disposing of items properly. The total number of SPRequest objects exceeds a configurable threshold. The best threshold varies according to the nature of your site and the applications running on it.

Paging in Datalists and other controls | Code Tricks- Tips and tricks on PHP, CGI, JavaScript, ASP, XML, CSS, and more! Anyone who's had to display data in multiple pages in ASP know how much trouble it can be. Although not very hard, it's tedious at best. This tutorial looks at using the PagedDataSource class to accomplish the task, and easily. In this tutorial, we will be looking at the PagedDataSource class and we'll see how the it can help us do paging for a DataList control. PagedDataSource Class The first thing we have to do is create a paged data source to hold our data which we want to display using the PagedDataSource class. Here is some typical code you would write for your paged data source. PagedDataSource pg = new PagedDataSource(); pg.DataSource = myHashTable; pg.AllowPaging = true; pg.PageSize = 5; DataSource Property The DataSource property is used to specify what data will be displayed when the ASP.NET page is rendered. We'll create some dummy data here so that this tutorial will work. We end up with a hash table that has the values of each entry being equal to 100 times the key. Closing

SharePoint Site Logo URL Limitations – Site Settings Page vs Web Part Pages « Nik Patel's SharePoint World Have you ever tried to change the site logo for the SharePoint 2010 Team Site with lots of web part pages or have you ever tried to specify a Site URL tokens on the site logo URLs to easily migrate the site pages from one environment to another environment without getting broken? This is another item where it’s really hard to understand why Microsoft implemented one of the most obvious tasks such a confusing way. Issue No.1 – Specify the Site Logo URL on both the Site Settings and each Web Part Pages. Without any SharePoint Designer customizations or Custom Code, if you want to change the site logo through browser interface, you have to take different steps to change the site logo for the site pages and web part pages. To change the site logo for the site pages or application pages hosted in the _layouts directory, visit the site settings -> Look and Feel Section -> Title, description, and icon link to change the site logo. Like this: Like Loading...

Learn CSS Positioning in Ten Steps: position static relative absolute float 1. position:static The default positioning for all elements is position:static, which means the element is not positioned and occurs where it normally would in the document. Normally you wouldn't specify this unless you needed to override a positioning that had been previously set. 2. position:relative If you specify position:relative, then you can use top or bottom, and left or right to move the element relative to where it would normally occur in the document. Let's move div-1 down 20 pixels, and to the left 40 pixels: Notice the space where div-1 normally would have been if we had not moved it: now it is an empty space. It appears that position:relative is not very useful, but it will perform an important task later in this tutorial. 3. position:absolute When you specify position:absolute, the element is removed from the document and placed exactly where you tell it to go. Let's move div-1a to the top right of the page: What I really want is to position div-1a relative to div-1. Footnotes 10.

How Do I Get Paths and URL fragments from the HttpRequest object? - Cambia Research Summary If you have done much ASP.NET programming you have probably spent a lot of time mapping urls to physical disk locations and vice versa. This need arises whenever you store files on the server or do some kind of URL parsing and re-routing of incoming requests. This article will examine the properties of the Request object that will provide path and url information related to the application and the current request. First, here are a couple of tables of useful properties on the Request object and an example of the text they return for a given input URL. For some reason unclear to me, the Url.Fragment property is usually empty instead of showing "#fragment". Input: Input: The following is the C# method I used to process the URLs above and generate the output tables. Back to Top

Formatting Types [This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.] The .NET Framework provides a consistent, flexible, and comprehensive means for you to represent any of the numeric, enumeration, and date and time base data types as a string. Formatting is controlled by strings of format specifier characters that indicate how a base type value is to be represented. For example, format specifiers indicate whether a formatted number should be represented in scientific notation, or whether a formatted date should present the month as a number or a name. The .NET Framework also uses cultural settings to represent a base type in a form appropriate to a particular culture. The .NET Framework allows you to define custom formatting schemes and custom cultural settings. Describes standard and custom format strings used to create string representations of numeric types. Describes how to embed one or more formatted values in a string.

SharePoint Interview Questions for Developers | SharePoint Programming Interview Questions for Developers - A four-part series. Part 1 Part 2 Part 3 Part 4 Part 5 {new} Q. What Do you know about SharePoint Object Model? Ans. In Sharepoint Object model there are two Important namespaces. The .Office.Server namespace is the root namespace of all Office Server objects and .SharePoint is the root namespace for all WSS objects.Read More at SharePoint 2007 Object Model Q. Ans. Q. Ans. Q. Ans. Q. Ans. Q: What is the performance impact of RunWithElevatedPrivileges? Ans. Q. Ans. Q. Ans. Q. Ans. Q. Ans. Q. Q: When should you dispose SPWeb and SPSite objects? Ans. Q. Ans. 1. 2. 3. 4. 5. Q.What is the main difference between using SPListItem.Update() and SPListItem.SystemUpdate()? Ans. Related Posts : Sharepoint 2007 Tutorial for beginners ShrarePoint 2007 Interview Question for Administrator

Double.Parse Method (String, NumberStyles) (System) The s parameter can contain the current culture's NumberFormatInfo.PositiveInfinitySymbol, NumberFormatInfo.NegativeInfinitySymbol, or NumberFormatInfo.NaNSymbol. Depending on the value of style, it can also take the form: [ws][$][sign][integral-digits[,]]integral-digits[.[fractional-digits]][E[sign]exponential-digits][ws] Elements in square brackets ([ and ]) are optional. string value; value = Double.MinValue.ToString(); try { Console.WriteLine(Double.Parse(value)); } catch (OverflowException) { Console.WriteLine("{0} is outside the range of the Double type