Click here to Skip to main content
13,052,641 members (56,226 online)
Rate this:
Please Sign up or sign in to vote.
I have a windows application from which an web application is starting.

private void Home_Load(object sender, EventArgs e)
           string url = string.Format("http://localhost:49916/Express/Login.aspx?yek@soh={0}", System.Configuration.ConfigurationSettings.AppSettings["HK"].ToString());
           Process.Start("IExplore.exe", url);

It is working fine in my source code.

I created a setup for this application.
And installed.. successful.. but when I tried to run the installed application.. it is throwing error like below.

System.NullReferenceException: Object reference not set to an instance of an object.
   at HospitalClient_App.Home.Home_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

If I change the line
Process.Start("IExplore.exe", url);


the installed program is running fine..

Can anybody help me in this regards...

Thanks in anticipation
Posted 2-Jul-13 21:43pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Then you probably don't have the key ("HK") in the AppSettings. Have another look at it.

* NOTE: This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings

Good luck,
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Because, the app.config is placed in the right location but not renamed to the application name.. it was still "app.config" but it supposed to be "applicationname.exe.config".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 18 Jul 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100