Have you experienced coding and all of a sudden when on windows 10 you experienced that MM/dd/yyyy is not a valid date? This is because of the culture that is default implemented on your device, in this case on my device with Windows 10 Pro. To cause of this is the machine is by default is using dd/MM/yyyy and in this case apps that we are developing is having this kind of issue.
Thank fully the fastest way to fix is via the web.config with the following code:
<globalization culture=”en-US” uiCulture=”en-US”/>
And then run again your application and it will now accept your MM/dd/yyyy.
What is ELMAH?
- ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.
- Once ELMAH has been dropped into a running web application and configured appropriately, you get the following facilities without changing a single line of your code:
- Logging of nearly all unhandled exceptions.
- A web page to remotely view the entire log of recoded exceptions.
- A web page to remotely view the full details of any one logged exception, including colored stack traces.
- In many cases, you can review the original yellow screen of death that ASP.NET generated for a given exception, even with customErrors mode turned off.
- An e-mail notification of each error at the time it occurs.
- An RSS feed of the last 15 errors from the log.
How to Install ELMAH on your MVC Project?
- Open Nuget Package Manager on the MVC Project
- Search for ELMAH and Install it.
- Then configure it.
- It will already add some configuration under your web.config but we need to include some configuration so that it will point to a database.
<add name=”elmahConnectionString” connectionString=”Data Source=Server;Initial Catalog=ELMAH_DEV;uid=user;pwd=user;Pooling=true;Min Pool Size=0;Max Pool Size=999;” providerName=”System.Data.SqlClient” />
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
more information on remote access and securing ELMAH.
<security allowRemoteAccess=”true” />
<errorLog type=”Elmah.SqlErrorLog, Elmah” applicationName=”NameOfApplication_DEV” connectionStringName=”elmahConnectionString” />
- We also need to remove some sections that we don’t need specially the section below that automatically create a page for the logs.
<location path=”elmah.axd” inheritInChildApplications=”false”>…</location>
- All uncatched exception will automatically be recorded.
- All exception handling will NOT be recorded automatically. It needs to be manually logged by including the Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
throw new Exception(“Some Exception”);
We are glad to invite you to our first Free service product, OpenCast. OpenCast is an online broadcasting websites that aim to help people broadcast freely and openly. The website is created using ASP.Net MVC, Entity Framework, SignalR, & OpenTok.
Feel Free to register now at http://opencast.info
Have you ever experience the following error in ASP .NET? A potentially dangerous Request.Form value was detected from the client..
Have you ever experience the following error in ASP .NET?
A potentially dangerous Request.Form value was detected from the client
Then you are one like me. Then you should now that one of the values of your elements (<inputs> or <button> or <textarea>) has html elements on it. Example is bellow:
Then you should also know that this error is persisting because the values given above might be an XSS attack. If you are sure that you want to accept this type of values on your dabatase you may explicitly remove this validation by adding this tag to your page’s masterpage or 1st line of tag.
If you are on ASP .NET MVC you can add this to your model, assuming that your model has the content variable.
public string content = String.Empty;
Thanks hope it help you allot. Also if you are not familiar with XSS attacks, I will try to make an article for that so you can create your own script that is hack-able, be able to prevent it, and know what are it’s crons.
jQuery Extension for ASP .Net MVC Opensource and Paid
My boss told us to search for a jQuery Extension for ASP .Net MVC to make the development easier. After minutes of searching the web I have found two extensions that you and I can use:
- DJME 2 which is an free and Open source
- Telerik Extensions for ASP .NET in this case is a paid extension
Both extensions utilizes the creation of custom helper to make jQuery development quite easier but abstracted. Abstracted because you are learning how the extensions should be use to produce jQuery but your not really coding jQuery.
Easiest Email on ASP .Net mvc 3 using webmail using gmail
I have been searching the web on how to easily send email thru ASP .NET MVC 3 and finally found the right code for it, its called WebMail. Look at the code below and insert it to one of your Controller’s Action:
WebMail.SmtpServer = “smtp.gmail.com”;
WebMail.EnableSsl = true;
WebMail.SmtpPort = 25;
WebMail.UserName = “firstname.lastname@example.org”;
WebMail.Password = “**********”;
WebMail.From = “email@example.com”;
WebMail.Send(“********@******.com”, subject:”Subject”, body:”Message Here”);
Then try it on!
Its the Easiest Email on ASP .Net mvc 3 using webmail using gmail!