Showing posts with label MVC. Show all posts
Showing posts with label MVC. Show all posts

Wednesday, 15 June 2016

404 error on MVC web-site

Hi,

Today, I was started working on MVC application. I have taken the Template in Visual Studio and checked it from VS and it is working. Then I have published the things and hosted the same on IIS. When I browsed, it started giving 404 error. After some search, came to know that ASP.Net was not registered with IIS.

Follow below steps to register

Windows 7 and earlier
1. Run the Command Prompt (cmd.exe) as an administrator.
2. Navigate to the appropriate .NET Framework location. (e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319)
3. Run aspnet_regiis.exe -i


For Windows 8 and above
1. From the start menu, type "Turn windows features on or off" and select the first result.
2. Expand Internet Information Services: World Wide Web Services: Application Development Features and select ASP.NET 4.5/4.6/whatever version you see (or ASP.NET 3.5 if you need to support projects on .NET Framework 2.0-3.5).
3. Click OK.


--
Happy Coding

Gopinath

Sunday, 15 November 2015

Allow only numbers in a text box

Hi,

In most of web applications, we get requirement to allow only number in a textbox.

Here is the JavaScript for it, just call this method onKeyPressv Event.

<HTML>
   <HEAD>
   <SCRIPT language=Javascript>
      <!--
       function isNumberPressed(evt) {
           var charCode = (evt.which) ? evt.which : event.keyCode
           if (charCode > 31 && (charCode < 48 || charCode > 57))
               return false;
           return true;
       }
      //-->
   </SCRIPT>
   </HEAD>
   <BODY>
      <INPUT id="txtChar" onkeypress="return isNumberPressed(event)" type="text" name="txtChar">
   </BODY>
</HTML>
 
Hope this helps.

--
Happy Coding
Gopinath