Skip to main content

Posts

Showing posts from July, 2013

ASP.NET Cookies Overview

ASP.NET Cookies Overview A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. The cookie contains information the Web application can read whenever the user visits the site. Scenarios Background Code Examples Class Reference Additional Resources What's New http://msdn.microsoft.com/en-us/library/ms178194.aspx

How to Increase page load speed of website

We can do by taking few steps in development  those  are refer  http://www.codeproject.com/Articles/196378/Best-Practices-to-Improve-ASP-NET-Web-Application http://msdn.microsoft.com/en-us/magazine/cc163854.aspx http://dotnet.dzone.com/articles/increase-performance-aspnet As per Design   Several things: Minimize your javascript and CSS files.  Google has a nice minimizer  for JS. Cache images, js files and css files. Info on how to do this from IIS,  here . Disable ViewState  if you can   or at least enable it only on the controls that need it. Use compression on IIS Use a content delivery network (CDN) to deliver javascript libraries such as jQuery, etc. Optimize your images using  Smush.it Put javascript code at the bottom of the page so that the page starts rendering faster If you use JSON for data interchange between the UI and the backend, make sure you compress it, too. Use  sprite me  to create sprites for your image icons, backgrounds, etc.

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive

This typically happens when you have an attribute of  targetFramework="4.0"  in the web.config but the App Pool is set to run ASP.NET 2.0. The  targetFramework  attribute is entirely unrecognized by ASP.NET 2.0 - so changing it to 2.0 won't have the desired effect. Contact Support / Your Administrator and have the AppPool switched to 4.0. You could also remove the attribute entirely, however if your site was coded with the 4.0 Framework, then I'm sure something else will cause an error as well.

How to download a file in ASP.Net

Here is perhaps the simplest, shortest way to download a file in an ASP.Net application: Response.ContentType = "application/pdf" ; Response.AppendHeader( "Content-Disposition" , "attachment; filename=MyFile.pdf" ); Response.TransmitFile(Server.MapPath( "~/Files/MyFile.pdf" )); Response.End(); The first step is to set the content type.   In the example above, we're downloading a .pdf file.  Here are some of the most common content types: .htm, .html     Response.ContentType = "text/HTML"; .txt    Response.ContentType = "text/plain"; .doc, .rtf, .docx    Response.ContentType = "Application/msword"; .xls, .xlsx    Response.ContentType = "Application/x-msexcel"; .jpg, .jpeg    Response.ContentType = "image/jpeg"; .gif    Response.ContentType =  "image/GIF"; .pdf    Response.ContentType = "application/pdf"; Response.TransmitFile retrie

Remove html tags from SQL Query

Use the bellow function to Remove html tags from SQL Query create function dbo.StripHTML( @text varchar(max) ) returns varchar(max) as begin     declare @textXML xml     declare @result varchar(max)     set @textXML = REPLACE( @text, '&', '' );     with doc(contents) as     (         select chunks.chunk.query('.') from @textXML.nodes('/') as chunks(chunk)     )     select @result = contents.value('.', 'varchar(max)') from doc     return @result end go select dbo.StripHTML('<html>This <i>is</i> an <b>html</b> test<br/></html>')

Detecting Mobile Devices In asp.net

 Is  just one of 51Degrees.mobi components for mobile web development. It’s provided as a .NET open source class library that detects mobile devices and browsers, enhancing the information available to .NET programmers. Using 51Degrees.mobi Device Data, accurate screen sizes, input methods, plus manufacturer and model information are all available. Mobile handsets can optionally be redirected to content designed for mobile devices. Smart phones, tablets and feature phones are all supported. For More Info  http://51degrees.codeplex.com/

Different HTML Editor In Asp.net

Ajax Html Editor Extender http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/HTMLEditorExtender/HTMLEditorExtender.aspx We can use  WYSIWYG editors. You may have a look at TinyMCE, http://www.tinymce.com/ TinyMCE Editor http://www.codeproject.com/Articles/88142/Integrating-TinyMCE-Editor-with-ASP-NET For intergrating this into an ASP.NET application, please refer to http://www.codeproject.com/KB/aspnet/IntegratingTinyMCE.aspx

Inserting data into ms access database 2007 from visual studio 2010 using c#.net

Use this code to save data into the Ms access database using c#.net  public void savedata()    {         OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\SR050\\Documents\\VisitingCard.accdb");                    con.Open();             OleDbCommand cmd = new OleDbCommand("VisitingCard_Insert", con);             cmd.CommandType = CommandType.StoredProcedure;             cmd.Parameters.AddWithValue("@Names", textBox1.Text);             cmd.Parameters.AddWithValue("@Organization", textBox2.Text);             cmd.Parameters.AddWithValue("@Location", textBox3.Text);             cmd.Parameters.AddWithValue("@PhoneNo", textBox4.Text);             cmd.Parameters.AddWithValue("@EmailId", textBox5.Text);             int result = cmd.ExecuteNonQuery();             con.Close();             if (result > 0)              {                 MessageBox.Show("Inserted Succe

MicrosoftTranslator Widget

Translator Widget The Translator web page widget allows you to bring real-time, in-place translation to your web site.    Copy Bellow code and page in your page  it will work  <div id='MicrosoftTranslatorWidget' class='Dark' style='color:white;background-color:#555555'></div><script type='text/javascript'>setTimeout(function(){{var s=document.createElement('script');s.type='text/javascript';s.charset='UTF-8';s.src=((location && location.href && location.href.indexOf('https') == 0)?'https://ssl.microsofttranslator.com':'http://www.microsofttranslator.com')+'/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**&ctf=True&ui=true&settings=Manual&from=en';var p=document.getElementsByTagName('head')[0]||document.documentElement;p.insertBefore(s,p.firstChild); }},0);</script> Refer http://www.bing.

How to merge two columns value into single column in sql select statement

SQL Query to get aggregated result in comma separators along with group by column in SQL Server My table would be in the below format |`````````|````````| | ID | Value | | _________ | ________ | | 1 | a | | _________ | ________ | | 1 | b | | _________ | ________ | | 2 | c | | _________ | ________ |   Expected result should be in the below format |`````````|````````| | ID | Value | | _________ | ________ | | 1 | a , b | | _________ | ________ | | 2 | c | | _________ | ________ |   Sql Query    You want to use FOR XML PATH construct: select ID , stuff (( select ', ' + Value from YourTable t2 where t1 . ID = t2 . ID for xml path ( '' )), 1 , 2 , '' ) [ Values ] from YourTable t1 group by ID The STUFF function is to get rid of the leading

Asp.net Url Routing vs Rewriting

IIS URL Rewriting When a client makes a request to the Web server for a particular URL, the URL-rewriting component analyzes the requested URL and changes it to a different other URL on the same server. The URL-rewriting component runs very early in the request processing pipeline, so is able to modify the requested URL before the Web server makes a decision about which handler to use for processing the request. ASP.NET Routing ASP.NET routing is implemented as a managed-code module that plugs into the IIS request processing pipeline at the Resolve Cache stage (PostResolveRequestCache event) and at the Map Handler stage (PostMapRequestHandler). ASP.NET routing is configured to run for all requests made to the Web application. Differences between URL rewriting and ASP.NET routing: URL rewriting is used to manipulate URL paths before the request is handled by the Web server . The URL-rewriting module does not know anything about what handler will eventually process

ASP.NET Routing

ASP.NET routing enables you to use URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users. The ASP.NET MVC framework and ASP.NET Dynamic Data extend routing to provide features that are used only in MVC applications and in Dynamic Data applications. For more information about MVC, see ASP.NET MVC 3 . For more information about Dynamic Data, see ASP.NET Dynamic Data Content Map . In an ASP.NET application that does not use routing, an incoming request for a URL typically maps to a physical file that handles the request, such as an .aspx file. For example, a request for http://server/application/Products.aspx?id=4 maps to a file that is named Products.aspx that contains code and markup for rendering a response to the browser. The Web page uses the query string value of id=4 to determine what type of c