C#.net的调试和发布 [英] Debug and Release for C#.net

查看:48
本文介绍了C#.net的调试和发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在asp.net应用程序中,如果选择了debug is mode,那么我必须将默认的用户名和密码带到登录页面并显示在resp文本框中,以便我只需单击登录按钮即可工作,但处于发布模式我必须输入我的凭据,然后进入站点,

任何用于执行此功能的代码的想法,如果有人最早答复,将非常有帮助.

In the asp.net application, if debug is mode is selected then i must bring a default username and password to the login page and display in resp textbox so that i would just click the login button and work,but in release mode i must enter my credentials and then enter the site,,,

Any idea of the code used to do this function,it would be very helpful if anyone reply at the earliest.

推荐答案

我一直在这样做.我在web.config中添加值,一个用于调试模式(true或false),然后另一个用于我要在调试模式下使用的值(例如用户以as身份自动登录).然后,我编写一个强类型的类,该类从web.config中获取这些值,并在整个代码中使用它们.
I do this all the time. I add values in the web.config, one for the debug mode ( true or false ) and then others for the values I want to use in debug mode ( like the user to auto log in as ). Then I write a strongly typed class that grabs these values from the web.config, and use them throughout the code.


将其添加到表单构造函数或Load事件:
Add this to your form constructor, or the Load event:
#if DEBUG
            tbUserName.Text = "My Debug User";
#endif


这篇关于C#.net的调试和发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆