Posts

Jquery UI Multiple Search MVC

For creating autocomplete multiple select using the jquery UI plugin.
<linkrel="stylesheet"href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<label>Search fruits:</label> <inputtype="text"id="txtFruits"name="txtFruits"/>
<scriptsrc="https://code.jquery.com/jquery-1.12.4.js"></script> <scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<scripttype="text/javascript">

Jquery UI search (autocomplete) MVC

For creating a search bar like google we can use the jquery UI plugin.

<linkrel="stylesheet"href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<label>Search fruits:</label> <inputtype="text"id="txtFruits"name="txtFruits"/>
<scriptsrc="https://code.jquery.com/jquery-1.12.4.js"></script> <scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<scripttype="text/javascript"language="javascript">     $(document).ready(function () {         $('#txtFruits'

How to add SSL to Website...

The steps to add the SSL to a website are as follows.
1) We need to request for the CSR (Certificate Signing Request) from where our website is hosted.

What is a CSR?
 A CSR or Certificate Signing request is a block of encoded text that is given to a Certificate Authority when applying for an SSL Certificate. It is usually generated on the server where the certificate will be installed.

2) Once requested you need to provide the below mention details.
Common Name (Domain Name)
Organization Name
Organizational Unit  (Department)
City/Locality
State/County/Region 
Country  
Email address  


Once done they will provide you with the CSR

CSR Format
Example

-----BEGIN CERTIFICATE REQUEST-----
MLLByjCCATMCAQAwgYkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
Q0uA0aVog3f5iJxCa3Hp5gxbJQ6zV6kJ0TYsuaaOhEko9sdpCoPOnRBm2i/XRD2D
8iNh8f8z0ShGsFqjDgFHyF3o+lUyj+UC6H1QE7bn
-----END CERTIFICATE REQUEST-----
Note*- When you are trying to generate the SSL Certificate copy all the CSR including the -----BEGIN CERTIFICATE …

Restrict modifying the URL or Route in MVC

To restrict the user from modifying the URL. Write the following code in the Global.asax.cs file.

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
        public class NoDirectAccessAttribute : ActionFilterAttribute
        {
            public override void OnActionExecuting(ActionExecutingContext filterContext)
            {
                if (filterContext.HttpContext.Request.UrlReferrer == null ||
                            filterContext.HttpContext.Request.Url.Host != filterContext.HttpContext.Request.UrlReferrer.Host)
                {
                    filterContext.Result = new RedirectToRouteResult(new
                                   RouteValueDictionary(new { controller = "Error", action = "Index", area = "" }));
                }
            }
        }

Then add this Action Filter to Controller [MvcApplication.NoDirectAccess]