45 subscribers

Software Dev
  |  Science Stuff  |  Travel  |  Golf  |  Entertainment  |  Mindfulness  |  Finance and Investing  |  Austin  |  India  |  Diet, Health  |  Petitions, Causes  |  Miscellaneous  |  

Lessons learnt from the world of Software Development, Object Oriented Design and .NET Architecture.

Converting a normal collection to IEnumerable | Posted on by Anuj Varma

Suppose you are stuck with a namevaluecollection – it is not of type IQueryable or IEnumerable. So – none of your LINQ queries will work on it.
Convert it to IEnumerable<T>
IEnumerable<string> canBeQueried = nvc.OfType<string>();

// To convert it to a string array … Continue reading

When you move your data layer to another project or another folder  – you may encounter the following exception
MetadataException: Unable to load the specified metadata resource
The Solution:
The following res: (resource) references need to point to your newly placed model
<add name=”Entities” … Continue reading

MVC apps–set as start page | Posted on by Anuj Varma

Of course, MVC does not have the concept of a web page – it is more a web view. The view cannot be accessed directly (unlike a page) – and can only be accessed through a controller action. So , … Continue reading

Disaster recovery levels–two important questions | Posted on by Anuj Varma

Some questions to consider while deciding on the DR level (disaster recovery level) for your app:

Is it a life-death situation app? e.g. EMS first responder app, CDC outbreak notification app etc.
What is the financial impact of the app (the app … Continue reading

Configuring an authentication header in fiddler | Posted on by Anuj Varma

Fiddler – Authentication header

Click Rules > Customize Rules….
Inside the OnBeforeRequest handler, add

oSession.oFlags["x-AutoAuth"] = “domain\\user:password”;

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode … Continue reading

Insert documents in Outlook Body | Posted on by Anuj Varma

For some reason, I prefer the inserts to be in the body as opposed to attachments. They are easier to get to (by the recipient) and they can be placed inside tables etc.- making the message more readable.
By default, Outlook … Continue reading

Suppose you have a list of strings – a nursery rhyme may be a good example.  And you need to find ALL the words that match from another list of words.
Using LINQ to search a list for items in … Continue reading

Prevent URI (XSS) rewrites in asp.net | Posted on by Anuj Varma

The Uri.IsWellFormedUriString method is well suited to check for any malformed URLs. It can be used to  validate the address and the entire query string.
var newUrl = Request.QueryString["Url"];
if (!Uri.IsWellFormedUriString(newUrl, UriKind.Absolute))
litLeavingTag.Text = “An invalid URL has been specified.”;
Continue reading

Update EDMX model with database changes | Posted on by Anuj Varma

Open the EDMX file within Visual Studio – use an Open With command from the right click menu
Open With -> ADO.NET Entity Data Model Designer
Right click on the designer surface of the EDMX designer and click Update Model From Database..

  … Continue reading

Data Security in SQL Server (and other databases) | Posted on by Anuj Varma

If you have sensitive data (e.g. HIPAA data), you need to consider both encryption as well as SALTING of your data at the database level.
Prior to 2008, SQL Server data encryption was a somewhat involved process. With the introduction of … Continue reading