Tag Archives: ASP.Net

ASP.Net

ASP.NET 4.0 potentially dangerous Request.Form value was detected

This was because .NET detected something in the entered text which looked like an HTML statement.
This is a feature put in place to protect your application cross site scripting attack and followed accordingly.

To disable request validation, I added the following to the existing “page” directive in that .aspx file.

ValidateRequest="false"

For .NET 4, we need to add requestValidationMode=”2.0″ to the httpRuntime configuration section of the web.config file like the following:

<httpRuntime requestValidationMode="2.0"/>

But if there is no httpRuntime section in the web.config file, then this goes inside the <system.web> section.

If anyone wants to turn off request validation for globally user, the following line in the web.config file within <system.web> section:

&lt;pages validateRequest=&quot;false&quot; /&gt; 
.NET Charts jQuery

Highcharts .Net (with vb sample)

Highcharts .Net is a charts library written in pure javascript, offering an easy way to add complex charts to your Web application. Highcharts .Net encapsulates the Highcharts API on ASP.net controls making it easier to use.

Project page at codeplex: http://highcharts.codeplex.com

You can see some Highcharts.Net examples at this link: http://highcharts.paulovich.com.br/

Install:

After download the newest release, add it as reference on your web application, and then add it to the page controls on your web.config:

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="highchart" namespace="Highchart.UI" assembly="Highchart"/>
</controls>
</pages>

After that, you only need to import the jQuery script.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

it’s ready to use 😉

aspx:

 

<highchart:columnchart id="hcVendas" width="600" height="400" runat="server"></highchart:columnchart>

VB Sample:


read more »

.NET ASP.Net 2.0 Chrome

Asp.net menu control not working on Google Chrome

To solve this you will need to tell .net the capabilities of the browser. For .net 2.0 & above you need to create a new browers file with the capabilities and upload it to your server.

  1. In VS2008 Solution Explorer right click your application and add the “ASP.Net Folder” App_Browsers if you don’t already have it.
  2. Add a New “Browser File” item to this special folder and call it safari.browser (if fixing the problem for Chrome)
  3. Delete all the default stuff VS put in this file and replace it with the following:
    <browsers>
    <browser refID=”safari1plus”>
    <controlAdapters>
    <adapter controlType=”System.Web.UI.WebControls.Menu” adapterType=”” />
    </controlAdapters>
    </browser>
    </browsers>
  4. Save your file & test locally to see if all is well.
  5. Now for the annoying bit. Upload the new app_browser folder & file to your production server, if you have used the “copy web site” menu option to upload or sharepoint or frontpage, these will create a new folder under app_browsers called vti_cnf
  6. Manually delete the vti_cnf folder under app_browser on your production server. If you don’t you’ll get “Parse error: Data at the root level is invalid. Line 1, position 1.” in your new safari.browser file.
  7. Remember to manually delete this vti_cnf folder everytime you make a change to the app_browser folder or contained files.

So there you go, how to solve the control rendering problems with Google’s Chrome.

For original post you can visit

http://fabenterprises.wordpress.com/2009/03/21/aspnet-menu-not-rendering-correctly-in-googles-chrome/

.NET ASP.Net Microsoft

List of Request.ServerVariables

ALL_HTTP HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:sv HTTP_HOST:localhost:1229 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
ALL_RAW Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Accept-Language: sv Host: localhost:1229 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
APPL_MD_PATH
APPL_PHYSICAL_PATH D:\code\web\demos\membership\
AUTH_TYPE NTLM
AUTH_USER SYSTEMEN-D9AE02\Stefan Holmberg
AUTH_PASSWORD
LOGON_USER SYSTEMEN-D9AE02\Stefan Holmberg
REMOTE_USER SYSTEMEN-D9AE02\Stefan Holmberg
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CERT_SUBJECT
CONTENT_LENGTH 0
CONTENT_TYPE
GATEWAY_INTERFACE
HTTPS
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
INSTANCE_ID
INSTANCE_META_PATH
LOCAL_ADDR 127.0.0.1
PATH_INFO /membership/servervariables.aspx
PATH_TRANSLATED D:\code\web\demos\membership\servervariables.aspx
QUERY_STRING
REMOTE_ADDR 127.0.0.1
REMOTE_HOST 127.0.0.1
REMOTE_PORT
REQUEST_METHOD GET
SCRIPT_NAME /membership/servervariables.aspx
SERVER_NAME localhost
SERVER_PORT 1229
SERVER_PORT_SECURE 0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE
URL /membership/servervariables.aspx
HTTP_CONNECTION Keep-Alive
HTTP_ACCEPT */*
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_ACCEPT_LANGUAGE sv
HTTP_HOST localhost:1229
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
ASP.Net Microsoft

Colors in ASP.NET

System.Drawing.Color

AliceBlue Hex Code: #F0F8FF
AntiqueWhite Hex Code: #FAEBD7
Aqua Hex Code: #00FFFF
Aquamarine Hex Code: #7FFFD4
Azure Hex Code: #F0FFFF
Beige Hex Code: #F5F5DC
Bisque Hex Code: #FFE4C4
Black Hex Code: #000000
BlanchedAlmond Hex Code: #FFEBCD
Blue Hex Code: #0000FF
BlueViolet Hex Code: #8A2BE2
Brown Hex Code: #A52A2A
BurlyWood Hex Code: #DEB887
CadetBlue Hex Code: #5F9EA0
Chartreuse Hex Code: #7FFF00
Chocolate Hex Code: #D2691E
Coral Hex Code: #FF7F50
CornflowerBlue Hex Code: #6495ED
Cornsilk Hex Code: #FFF8DC
Crimson Hex Code: #DC143C
Cyan Hex Code: #00FFFF
DarkBlue Hex Code: #00008B
DarkCyan Hex Code: #008B8B
DarkGoldenrod Hex Code: #B8860B
DarkGray Hex Code: #A9A9A9
DarkGreen Hex Code: #006400
DarkKhaki Hex Code: #BDB76B
DarkMagenta Hex Code: #8B008B
DarkOliveGreen Hex Code: #556B2F
DarkOrange Hex Code: #FF8C00
DarkOrchid Hex Code: #9932CC
DarkRed Hex Code: #8B0000
DarkSalmon Hex Code: #E9967A
DarkSeaGreen Hex Code: #8FBC8B
DarkSlateBlue Hex Code: #483D8B
DarkSlateGray Hex Code: #2F4F4F
DarkTurquoise Hex Code: #00CED1
DarkViolet Hex Code: #9400D3
DeepPink Hex Code: #FF1493
DeepSkyBlue Hex Code: #00BFFF
DimGray Hex Code: #696969
DodgerBlue Hex Code: #1E90FF
Firebrick Hex Code: #B22222
FloralWhite Hex Code: #FFFAF0
ForestGreen Hex Code: #228B22
Fuchsia Hex Code: #FF00FF
Gainsboro Hex Code: #DCDCDC
GhostWhite Hex Code: #F8F8FF
Gold Hex Code: #FFD700
Goldenrod Hex Code: #DAA520
Gray Hex Code: #808080
Green Hex Code: #008000
GreenYellow Hex Code: #ADFF2F
Honeydew Hex Code: #F0FFF0
HotPink Hex Code: #FF69B4
IndianRed Hex Code: #CD5C5C
Indigo Hex Code: #4B0082
Ivory Hex Code: #FFFFF0
Khaki Hex Code: #F0E68C
Lavender Hex Code: #E6E6FA
LavenderBlush Hex Code: #FFF0F5
LawnGreen Hex Code: #7CFC00
LemonChiffon Hex Code: #FFFACD
LightBlue Hex Code: #ADD8E6
LightCoral Hex Code: #F08080
LightCyan Hex Code: #E0FFFF
LightGoldenrodYellow Hex Code: #FAFAD2
LightGray Hex Code: #D3D3D3
LightGreen Hex Code: #90EE90
LightPink Hex Code: #FFB6C1
LightSalmon Hex Code: #FFA07A
LightSeaGreen Hex Code: #20B2AA
LightSkyBlue Hex Code: #87CEFA
LightSlateGray Hex Code: #778899
LightSteelBlue Hex Code: #B0C4DE
LightYellow Hex Code: #FFFFE0
Lime Hex Code: #00FF00
LimeGreen Hex Code: #32CD32
Linen Hex Code: #FAF0E6
Magenta Hex Code: #FF00FF
Maroon Hex Code: #800000
MediumAquamarine Hex Code: #66CDAA
MediumBlue Hex Code: #0000CD
MediumOrchid Hex Code: #BA55D3
MediumPurple Hex Code: #9370DB
MediumSeaGreen Hex Code: #3CB371
MediumSlateBlue Hex Code: #7B68EE
MediumSpringGreen Hex Code: #00FA9A
MediumTurquoise Hex Code: #48D1CC
MediumVioletRed Hex Code: #C71585
MidnightBlue Hex Code: #191970
MintCream Hex Code: #F5FFFA
MistyRose Hex Code: #FFE4E1
Moccasin Hex Code: #FFE4B5
NavajoWhite Hex Code: #FFDEAD
Navy Hex Code: #000080
OldLace Hex Code: #FDF5E6
Olive Hex Code: #808000
OliveDrab Hex Code: #6B8E23
Orange Hex Code: #FFA500
OrangeRed Hex Code: #FF4500
Orchid Hex Code: #DA70D6
PaleGoldenrod Hex Code: #EEE8AA
PaleGreen Hex Code: #98FB98
PaleTurquoise Hex Code: #AFEEEE
PaleVioletRed Hex Code: #DB7093
PapayaWhip Hex Code: #FFEFD5
PeachPuff Hex Code: #FFDAB9
Peru Hex Code: #CD853F
Pink Hex Code: #FFC0CB
Plum Hex Code: #DDA0DD
PowderBlue Hex Code: #B0E0E6
Purple Hex Code: #800080
Red Hex Code: #FF0000
RosyBrown Hex Code: #BC8F8F
RoyalBlue Hex Code: #4169E1
SaddleBrown Hex Code: #8B4513
Salmon Hex Code: #FA8072
SandyBrown Hex Code: #F4A460
SeaGreen Hex Code: #2E8B57
SeaShell Hex Code: #FFF5EE
Sienna Hex Code: #A0522D
Silver Hex Code: #C0C0C0
SkyBlue Hex Code: #87CEEB
SlateBlue Hex Code: #6A5ACD
SlateGray Hex Code: #708090
Snow Hex Code: #FFFAFA
SpringGreen Hex Code: #00FF7F
SteelBlue Hex Code: #4682B4
Tan Hex Code: #D2B48C
Teal Hex Code: #008080
Thistle Hex Code: #D8BFD8
Tomato Hex Code: #FF6347
Transparent Hex Code: #FFFFFF
Turquoise Hex Code: #40E0D0
Violet Hex Code: #EE82EE
Wheat Hex Code: #F5DEB3
White Hex Code: #FFFFFF
WhiteSmoke Hex Code: #F5F5F5
Yellow Hex Code: #FFFF00
YellowGreen Hex Code: #9ACD32
Apache ASP.Net

How to make Apache run ASP.NET / ASP.NET 2.0

Artigo interessante de Ohad’s Blog

Link: http://weblogs.asp.net/israelio/archive/2005/09/11/424852.aspx

read more »

ASP.Net 2.0

Função “CreateDataSet(ByVal strSQL)”

Função útil quando se pretende aceder de forma rápida a dados de uma tabela:

Function CreateDataSet(ByVal strSQL) As Data.DataSet
        Dim conn As Data.SqlClient.SqlConnection = New Data.SqlClient.SqlConnection(strConn)
        Dim cmd As New System.Data.SqlClient.SqlCommand(strSQL, conn)
        Dim da As New System.Data.SqlClient.SqlDataAdapter(cmd)
        Dim ds As New Data.DataSet
        da.Fill(ds)
        conn.Close()
        conn.Dispose()
        Return ds
End Function

Acedendo aos valores:

label1.text = CreateDataSet(" SELECT ClienteID, Nome FROM Clientes WHERE ClienteID=23").Tables(0).Rows(0).Item(1).ToString

 
-> Zé Carlos