Disable autocomplete on a specific field and on the whole form asp.net

Filed in .Net Leave a comment

<asp:TextBox ID=”txtAbstractTitle” runat=”server” ValidationGroup=”vsAbstractSerial”                                  MaxLength=”500″ Width=”200px” autocomplete=”off” ></asp:TextBox>

<form id=”Form1″ method=”post” runat=”server” autocomplete=”off”>

Redirect parent page from iframe via c# code asp.net

Filed in .Net Leave a comment

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), “myUniqueKey”, “self.parent.location=’DEFAULT.aspx’;”, true);

Automatic redirection from Http to Https and vise versa using relative urls in asp.net

Filed in .Net | ASP.Net Configuration 1 Comment

A very nice contorl/project (recommend by my Chief Architect) for a very common problem which we all face when we need to secure only specific pages. Below is the link.

http://code.google.com/p/securityswitch/

I applied this in my production environment and it is working perfectly. All related issues are solvable/configurable.

Some useful email exchanges between me and Matt(the guy who made this) are added below as comments.

Let me summarize the steps (If your using Visual Studio 2010)

  1. Install-Package SecuritySwitch from VS > Tool > Extension Manager > Search “SecuritySwitch” install it, more details can be found on http://nuget.org/packages/SecuritySwitch.
  2. Above step set-up every thing for you for your development environment. (Put some attributes in you web.config, add some dlls etc)
  3. Now you need to specify your secure pages in web.config inside securitySwitch>paths>
  4. These are important attributes mode=”" baseInsecureUri=”" baseSecureUri=”"
  5. For the staging or production deployment please go through with the below comments.

jQuery image plugin

Filed in Javascript Leave a comment

http://leandrovieira.com/projects/jquery/lightbox/#

A potentially dangerous Request.Form value was detected from the client framework 4.0

Filed in .Net Leave a comment

http://www.codeproject.com/Tips/297679/A-potentially-dangerous-Request-Form-value-was-det

http://www.asp.net/whitepapers/request-validation

Defining a Readonly property in DataContact WCF

Filed in .Net Leave a comment

[DataMember(Name = Constants.OrderMaster.SalesTaxCalculated, Order = 24, IsRequired = false, EmitDefaultValue = false)]

public Nullable<System.Decimal> SalesTaxCalculated

{

get

{

if (this.State == Constants.USStates.FL)

{

return (this.OrderDetailTotal – this.PromoDeductions + this.ShippingAdditions) * 0.06m;

}

else

{

return 0;

}

}

//get {return 0;}

private set{ value= null;}

}

Adding a port in Windows firewall for WCF service

Filed in OS Leave a comment

From Windows Firewall > Advanced Settings > click Inbound rules > New Rule(right side pan) > A wizard open > select Port > add your desired port(s) > Next select options according to your needs > in the end give a name > you are done.

SQL Server 2008 R2 only Service Pack 1

Filed in SQL Leave a comment

Alternatively with the windows updates you can update your plain R2

Related Link

Getting string value from Enum

Filed in .Net Leave a comment

Nice article :http://blog.waynehartman.com/articles/84.aspx

public class EnumUtils

{

public static string stringValueOf(Enum value)

{

FieldInfo fi = value.GetType().GetField(value.ToString());

DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);

if (attributes.Length > 0)

{

return attributes[0].Description;

}

else

{

return value.ToString();

}

}

public static object enumValueOf(string value, Type enumType)

{

string[] names = Enum.GetNames(enumType);

foreach (string name in names)

{

if (stringValueOf((Enum)Enum.Parse(enumType, name)).Equals(value))

{

return Enum.Parse(enumType, name);

}

}

throw new ArgumentException(“The string is not a description or value of the specified enum.”);

}

}

———————————————–

public enum ShippingOptions

{

[DescriptionAttribute("2nd Day Air")]

SecondDayAir = 01,

[DescriptionAttribute("Next Day Air")]

NextDayAir = 02,

Ground = 03

}

————————————————

EnumUtils.stringValueOf(Enums.ShippingOptions SecondDayAir)

Answer is : 2nd Day Air

crystal report in VS 2010 not showing report in production environment

Filed in .Net Leave a comment

Copy C:\inetpub\wwwroot\aspnet_client on your website root

Main buy cialis tabs folder is C:\inetpub\wwwroot\aspnet_client\system_web

TOP