Let's Share

Error on publishing ASP.Net website from IIS

December 14th, 2009 trisnok

After teaching today, I found some errors while my students want to publish their ASP.Net website from IIS (Internet Information Service).

First, if you don’t know how to add your website to IIS, let me tell you how to do it.

1. Go to Control Panel->Administrative Tools->Internet Information Service

2. Right click on Default Web Site->New->Virtual Directory

3. Click Next->[Type your folder name or whatever/alias]->[Choose directory where you put your website's folder]->Ok

After you those steps, try to browse you website by right click on your folder name and choose Browse.

If your website shows on the right column, it means you can open your website from your browser by typing http://localhost/[your folder name/alias]. But if you find some error, maybe you can try to solve it by using these errors collection and the way to solve it.

1. You Are Not Authorized to View This Page

Answer

First, you can right click on your folder name or alias then choose All Tasks->Permission Wizard. Just click Next till it finish. Try again to browse your alias.

Second,

  1. Start Internet Services Manager, or open the Microsoft Management Console (MMC) that contains the IIS snap-in.
  2. Expand * server name, where server name is the name of the server.
  3. Right-click the virtual server or virtual directory (for example, Default Web Site) that you want to configure, and then click Properties.
  4. Click the Directory Security tab.
  5. Under Anonymous access and authentication control, click Edit.
  6. Click to select the Basic authentication (password is sent in clear text) check box.
  7. When you receive the Are you sure you want to continue? message, click Yes.
  8. Click to clear the Integrated Windows authentication check box.
  9. Click to clear the Anonymous access check box.
  10. Click OK, and then click OK.
  11. Quit the IIS snap-in

taken from this

2.  The current identity (LKIS-19\ASPNET) does not have write access to ‘C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.

Answer

ASP.Net applications run under a worker process, and this in turn must be run under a user account.  For security reasons, Microsoft won’t let this run as the SYSTEM account, because it has full control of your system.  Instead, it runs as a user called ASPNET.  LKIS-19 is apparantly your computer name.  And what the error is saying is that this ASPNET user on your computer does not have access to write to the folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\.  This is where ASP.Net generates its temporary files (mostly assembly DLL files), and the worker process user account must have write access to this folder for ASP.Net to launch.

So, log onto your computer as Administrator and open Windows Explorer.  Browse to C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\.  Right-click the “Temporary ASP.NET Files” folder and pick Properties.  Go to the Security tab, and click Add.  Type in [Compute Name]\ASPNET and click OK.  Then find the ASPNET user in the list, and Grant it Full Control.  Click OK.  Then, go to Control Panel -> Administrative Tools -> Services, find IIS Admin Service in the list, right-click it and pick Restart.

taken from here

3. Failed to access IIS metabase

Answer

If this error comes, just restart you Visual Studio from
All Program->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt

After that type : aspnet_regiis -i

Wait until the process finish. After that you can browse your application again.

4. Still not working??????

Answer

Okay, if still not working, right click on your alias or folder name, choose properties, please check them.

1. Virtual Tab

- Local Path: check Read, Log visits, Index this resources

- Execute Permission : Script only

- Application Protection : Medium (Pooled)

2.  Documents Tab

- Check Enable Default Document

- If you don’t find file Default.aspx, just add it.

3. ASP.NET Tab

- ASP.NET version : Choose your .net version, after that click OK

Then, try to browse your alias or folder name again, if any error show up again (usually about metabase) try to solve it by following the previous steps.

Okay, thanks for visiting and if you find another way to solve those errors you can share them here. happy

The current identity (LKIS-19\ASPNET) does not have write access to ‘C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.

Tags: Error in IIS, Error on ASP.NET website, Error on publishing ASP.Net website from IIS, Failed to access IIS metabase, Internet Information Service Error, The current identity (LKIS-19\ASPNET) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'., You Are Not Authorized to View This Page

Posted in Ms. dotNet | 61 Comments »

Simple Program to create XML from table in database, .NET

January 20th, 2009 trisnok

Hm..after I think for a while, i decide to post this simple program..
But I just want to share my knowledge. Actually I got this from internet too..but I just hope, just hope that I can help someone who really want to make xml from database.

Okey, If I want to make xml from database and show it in GridView (in case for web application /asp.net), these are the steps..

  1. Create your new Web site application and then open Default.aspx.cs or double click on Default.aspx. On formLoad type this code (better you type so you can more understand it):
    Include these library:

    using System.Data.SqlClient;
    using System.Xml;
    using System.Xml.Serialization;
    using System.Collections.Generic;
    using System.IO;

    protected void Page_Load(object sender, EventArgs e) {
    DataSet ds = new  DataSet();
    String constr = “Data Source = (local); Initial Catalog=[Choose ur db name] User ID = sa;
    Password = [ur db passwd]“
    ;
    SqlConnection newConn =  new SqlConnection(constr);
    String strcmd = “select * from [ur table]“;
    SqlDataAdapter da = new SqlDataAdapter(strcmd, newConn);
    da.Fill(ds, “[ur table]“);
    ds.WriteXml(MapPath(“FileName.xml”));
    }

  2. Then create the interface by dragging GridView and a Button from toolbox to Default.aspx.
  3. Double click on your button (it will show file Default.aspx.cs) and type this code

    protected void Button1_Click(object sender, EventArgs e) {
    XmlDataDocument doc = null;
    DataSet ds = new DataSet();
    string path =  Path.Combine(Request.PhysicalApplicationPath, “FileName.xml”);
    ds.ReadXml(path);
    doc = new XmlDataDocument(ds);
    GridView1.DataSource = ds;
    GridView1.DataBind();
    }

  4. Build your web site and then press the button, the data will show in the GridView. Good Luck!

If  you want to use Windows Application, it’s very simple. You just need to change the code inside the Button event. Look at this code

  1. Type this code inside button1 event

    private void button1_Click(object sender, EventArgs e) {
    XmlDataDocument doc = null;
    DataSet ds = new DataSet();
    ds.ReadXml(Application.StartupPath + @”\FileName.xml”);
    doc = new XmlDataDocument(ds);
    dataGridView1.DataSource = ds.Table[0];
    }

  2. That’s all, but don’t forget to move your xml file to bin\Debug\FileName.xml. Good Luck for you guys.

Remember this is just one of the way to create xml from database and show it in GridView, there are so many ways. I hope these simple code can help you.

Tags: .net, ADO.NET, asp.net, create xml from database, database, gridview, xml

Posted in Ms. dotNet | 12 Comments »

Ajax Control Toolkit Installation in Ms. Visual Studio 2005

December 10th, 2008 trisnok

Kemarin aku cari-cari langkah2 untuk menginstal ajax. Hehhe..maklum udah lupa, nih aku bagi2 yacs…semoga sukses semuanya…

by Nannette Thacker

To install the Ajax Control Toolkit, you need:
AjaxControlToolkit.zip
ASPAjaxExtSetup.msi

first download the zip file of AjaxControlToolkit and ASPAjaxExtSetup (you can download it from internet)

Install ASPAJAXExtSetup.msi and then unzip the files AjaxControlToolkit.zip into any directory. Give it a name like “AjaxControlToolkit.”  

Open your Visual Web Developer and right click in the Toolbox area. Select “Add Tab.” 

Name the tab with something like “Ajax Tookit.”  

Right click the new tab area, and select “Choose Items…” 

This will bring up a dialog box to “Choose Toolbox Items.” Select the “Browse” button. 

Browse to the directory where you unzipped the Ajax Toolkit files. There is a “SampleWebSite” directory within your “AjaxControlToolkit” directory. Browse to the “Bin” directory within the “SampleWebSite” directory. 

Find and select to open the “AjaxControlToolkit.dll” file. 

The Choose Toolbox Items dialog will appear, this time with the Ajax Tookit controls selected. Select the “OK” button. 

Open or create a web form within your project. Now when you open your toolbox, you will see all of the Ajax Control Toolkit controls, ready for use within your applications. 
 

~~~~~~May your dreams be in ASP.net!~~~~~~

You can download the document here.

ajax-control-toolkit-installation

 

Tags: ajax, asp.net, install

Posted in Ms. dotNet | 10 Comments »

  • Hi…

    My name is Eka Trisno Samosir from North Sumatera-Indonesia. Really wanna go to Taizé :) and still learning to be a good blogger.
    Thanks for stopping by!
  • Recent Posts

    • Stuck, have no idea
    • Life is Like a Cup of Coffee
    • Last time with Hernita
    • Eclipse Movie
    • Untitled
  • Categories

    • Movies Review
    • Ms. dotNet
    • My Religious
    • My Story
    • Troubleshooting
  • Twit-twit

    • Blogroll

      • Samosir
    • Frens

      • Ali Syah J. Samosir
      • Dion Barus
      • Irma Sari Barus
      • Nicholas Sihotang
      • Roberto Adiseputra
      • Samson
      • Sanhenra
    • My Community

    • Meta

      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org
      • RSS SideNotes
    • Help Me To Taizé

    Let's Share is proudly edited by Eka Trisno Samosir | Bob