Click here to Skip to main content
15,906,341 members
Home / Discussions / C#
   

C#

 
QuestionHow to use an image array in C# Pin
TJS4u13-Jan-09 1:44
TJS4u13-Jan-09 1:44 
AnswerRe: How to use an image array in C# Pin
DaveyM6913-Jan-09 2:02
professionalDaveyM6913-Jan-09 2:02 
QuestionOpen Document in Default Viewer Pin
half-life13-Jan-09 1:06
half-life13-Jan-09 1:06 
AnswerRe: Open Document in Default Viewer Pin
N a v a n e e t h13-Jan-09 1:20
N a v a n e e t h13-Jan-09 1:20 
GeneralRe: Open Document in Default Viewer Pin
half-life13-Jan-09 1:25
half-life13-Jan-09 1:25 
AnswerRe: Open Document in Default Viewer Pin
Giorgi Dalakishvili13-Jan-09 1:22
mentorGiorgi Dalakishvili13-Jan-09 1:22 
QuestionShutdown application? Pin
devvvy13-Jan-09 0:31
devvvy13-Jan-09 0:31 
AnswerRe: Shutdown application? Pin
Pete O'Hanlon13-Jan-09 0:39
mvePete O'Hanlon13-Jan-09 0:39 
devvvy wrote:
a. WPF apps? (Windows Presentation Foundation - I'm new to this)

Application.Current.Shutdown();
devvvy wrote:
b. ASP.NET APP (What if I jsut want to stop the webapp, not IIS?)


Shutting down the app in ASP.NET is more challenging. First of all, you need to add the following entry into your config file:
<httpRuntime enabled="false" />

Then, your shutdown code looks like this:
private void btnClose_Click(object sender, EventArgs e)
{
  Configuration config = OpenWebConfiguration(ApplicationPath);
  HttpRuntimeSection httpRuntimeSection = config.GetSection("system.web/httpRuntime") as HttpRuntimeSection;
  bool httpRuntimeSectionEnabled = httpRuntimeSection.Enable;

  httpRuntimeSection.Enable = !httpRuntimeSectionEnabled;
  SaveConfig(config);
}

private void SaveConfig(Configuration config) 
{
  RemotingManager.ShutdownTargetApplication();
  config.NamespaceDeclared = true;

  if (string.IsNullOrEmpty(ApplicationPath) || string.IsNullOrEmpty((string)Session[APP_PHYSICAL_PATH])) 
  {
    Server.Transfer("~/expired.aspx");
  }

  config.Save(ConfigurationSaveMode.Minimal);
}


"WPF has many lovers. It's a veritable porn star!" - Josh Smith

My blog | My articles | MoXAML PowerToys



GeneralRe: Shutdown application? Pin
devvvy13-Jan-09 0:41
devvvy13-Jan-09 0:41 
AnswerRe: Shutdown application? Pin
SeMartens13-Jan-09 0:48
SeMartens13-Jan-09 0:48 
Questionhow to disable multi select of checkbox in listview ? Pin
Denver Thomas13-Jan-09 0:10
Denver Thomas13-Jan-09 0:10 
AnswerRe: how to disable multi select of checkbox in listview ? Pin
Wendelius13-Jan-09 0:18
mentorWendelius13-Jan-09 0:18 
AnswerRe: how to disable multi select of checkbox in listview ? Pin
Reza Raad13-Jan-09 0:20
Reza Raad13-Jan-09 0:20 
AnswerRe: how to disable multi select of checkbox in listview ? PinPopular
hground26-Mar-10 6:30
hground26-Mar-10 6:30 
GeneralRe: how to disable multi select of checkbox in listview ? Pin
molesworth26-Mar-10 7:27
molesworth26-Mar-10 7:27 
GeneralRe: how to disable multi select of checkbox in listview ? Pin
MarqW18-May-10 2:30
MarqW18-May-10 2:30 
GeneralRe: how to disable multi select of checkbox in listview ? [modified] Pin
mycleverscreenname23-Aug-10 8:04
mycleverscreenname23-Aug-10 8:04 
GeneralRe: how to disable multi select of checkbox in listview ? Pin
jerryno67-Oct-11 6:26
jerryno67-Oct-11 6:26 
GeneralRe: how to disable multi select of checkbox in listview ? Pin
MarqW9-Oct-11 20:44
MarqW9-Oct-11 20:44 
GeneralRe: how to disable multi select of checkbox in listview ? Pin
jerryno610-Oct-11 0:09
jerryno610-Oct-11 0:09 
SuggestionRe: how to disable multi select of checkbox in listview ? Pin
MarqW10-Oct-11 0:21
MarqW10-Oct-11 0:21 
Questionadd user control in datagridview in c# Pin
monuSaini13-Jan-09 0:08
monuSaini13-Jan-09 0:08 
AnswerRe: add user control in datagridview in c# Pin
Vivek Bhatnagar13-Jan-09 0:44
Vivek Bhatnagar13-Jan-09 0:44 
GeneralRe: add user control in datagridview in c# Pin
monuSaini13-Jan-09 0:51
monuSaini13-Jan-09 0:51 
GeneralRe: add user control in datagridview in c# Pin
Vivek Bhatnagar13-Jan-09 1:06
Vivek Bhatnagar13-Jan-09 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.