Tag Archives: ASP

ASP Classic Show Their Error Message

Hi There!

Have you get a notifications when ever you experience an error on your script. Especially when you getthe error message:

An error occurred on the server when processing the URL. Please contact the system administrator

If you are developing ASP Classic in IIS 7.+ make sure that your ASP Classic show their error message and not the message above. This will help you in your development especially when an error occurs. This same situation happen to us when developing the said Scripting Language and IIS 7.+ default its error showing message to false. To modify this just follow this steps:

  1. Go to your IIS Manger.
  2. Select the ASP Icon.
  3. Under the Compilation Table open the Debugging Properties
  4. Make the Send Errors to Browser to TRUE
 
 

jQuery Extension for ASP .Net MVC

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:

  1. DJME 2 which is an free and Open source
  2. 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. 

So in the end, I will still recommend using jQuery it self, doing all the hard works of creating the JavaScript file and code all the way, so you can produce the right jQuery output you have ever wanted.

ASP .Net MVC 3 – WebMail

Hi,

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 = “[email protected]”;
WebMail.Password = “**********”;
WebMail.From = “[email protected]”;
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!

ASP .Net MVC 3 File Upload

Doing File Upload in ASP .Net MVC 3 is easier than ASP .Net Web Form. On this example Only two controller and one view is needed to perform this task.

Controller

public class FileController : Controller
    {
        //
        // GET: /File/
 
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Upload(HttpPostedFileBase f)
        {
            if (f.ContentLength > 0)
            {
                string filePath = Path.Combine(HttpContext.Server.MapPath(“\\Uploads\\”), Path.GetFileName(f.FileName));
                f.SaveAs(filePath);                
            }
            return RedirectToAction(“Index”);
        }
 
    }
 
View
@{
    ViewBag.Title = “Index”;
}
 
<h2>Index</h2>
 
@using (Html.BeginForm(“Upload”, “File”, FormMethod.Post, new { enctype = “multipart/form-data” }))
{
    @Html.ValidationSummary(true)
 
    <input type=”file” name=”f” /><br />
    <input type=”submit” value=”Submit” />
}
 
Thats it. 
 
Download the source Here

public class FileController : Controller    {        //        // GET: /File/
        public ActionResult Index()        {            return View();        }        [HttpPost]        public ActionResult Upload(HttpPostedFileBase f)        {            if (f.ContentLength > 0)            {                string filePath = Path.Combine(HttpContext.Server.MapPath(“\\Uploads\\”), Path.GetFileName(f.FileName));                f.SaveAs(filePath);                            }            return RedirectToAction(“Index”);        }
    }

The index.html, What is it?

Have you ever wonder what is an index.html?

 

An index.html, in some cases default.html, is the main page of our website. It is the default file that our browser/server look for to view our website. The file extension(.html) also varies to what programming language we are using.

  • PHP -> index.php
  • ASP -> index.asp
  • ASP.Net ->index.aspx
  • JSP -> index.jsp
  • HTML ->index.html

It can also be set on some programming language on what specific file should the browser/server look for.

 

So be reminded that if you are developing a website that you should set the main page’s file name of your website to index.