Category Archives: Asp.net

Installing IIS and WAMP on same computer

To run IIS and wamp server on the same computer all you need to do is to change the port address.

First, install IIS on your machine , start IIS manager, click on websites–>Right click on Default Websites  and select Properties —> Select Website –> TCP Port- enter port number, say 1025.  Now you can run IIS at http://localhost:1025/

Then install Wamp server, it will run on http://localhost/

Issues in running asp.net files on IIS

After installing IIS on my local machine, when I tried to see an aspx page (http://localhost/test.aspx), the browser opened a pop up window asking me whether I have to open or save the file.

Searched in google –  how to fix this issue, nothing turned out into success.  At last I realized that I haven’t installed Microsoft .net framework , installed it and aspx files are running smoothly. If anyone comes into such a situation this tip may be helpful.

Inserting data into access database using Asp.Net

I was trying to insert data into access database from an asp.net page.

I could not find any samples in tutorials. So I thought to put the code (that worked for me) here. If anyone is looking for a sample I hope it would be helpful.

<%@ Import Namespace=”System.Data.OleDb” %>
<script runat=”server”>
Sub submit(sender As Object, e As EventArgs)

Dim conCoaxis As OleDbConnection
Dim strInsert As String
Dim cmdInsert As OleDbCommand
Dim dtmDate As DateTime
   
dtmDate = DateTime.Now()
 
conCoaxis=New OleDbConnection(“Provider=Microsoft.Jet.OLEDB.4.0;data source=” & server.mappath(“email.mdb”))
strInsert = “INSERT INTO email (Email, Fname, CompanyName, [Date]) Values (@Email, @Fname, @CompanyName, @Date)”
 
cmdInsert = New OleDbCommand( strInsert, conCoaxis )
 
cmdInsert.Parameters.Add( “@Email”, txtEmail.Text )
cmdInsert.Parameters.Add( “@Fname”, txtName.Text )
 cmdInsert.Parameters.Add( “@CompanyName”, txtCompany.Text )
 cmdInsert.Parameters.Add( “@Date”, OleDbType.Date).Value = dtmDate.ToString(“g”)  
  Try
   conCoaxis.Open()
   cmdInsert.ExecuteNonQuery()
   conCoaxis.Close()
   Response.Write(“Updated Successfully!<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>”)
   Catch
   conCoaxis.Close()
  End Try
 End Sub
</script>
<%@ Page Language=”VB” ContentType=”text/html” ResponseEncoding=”iso-8859-1″ Debug=”true” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
</head>
<body>
<form  runat=”server” id=”form1″ name=”form1″ method=”post” action=””>
  Name:     <asp:TextBox id=”txtName” runat=”server” /> 

Email:    <asp:TextBox id=”txtEmail” runat=”server” />
Company:    <asp:TextBox id=”txtCompany” runat=”server” />
 <asp:Button id=”id” text=”Submit” OnClick=”submit” runat=”server” />
</form> 
</body>
</html>