|
Hi Mazdak !
Thanks for the info, I was wondering if the "Installer" that includes Visual Studio can have that option ( I think it seems not... crappy installer... maybe for VStudio 2004 they should enhance it, deployment it's 80 % of the times neccesary).
Bye
Braulio
|
|
|
|
|
Braulio Díez wrote:
Is it possible ( if the user has enough right on that machine) to install it "remote" ?
Why don't you try it and see? The code to do this is a custom action - a compiled DLL hidden from our prying eyes. Only trying it would tell you.
More than likely, though, it goesn't because it doesn't ask for a machine name for which it gets the remote metabase for IIS (via the "iis://" management request). There's nothing stopping you from creating your own if you know how. The installer solution (using Windows Installer) is not meant to be a production-grade solution. For that, see Wise for Windows Installer[^] (have used it from the beta-testing days with them and love it) or the much more expensive and bloated InstallShield Developer[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, I am trying to create a very simple authentication form, and am receiving an error. Please help!!
This is the code i have used:
public class login : System.Web.UI.Page <br />
{ <br />
protected System.Web.UI.WebControls.TextBox txtUsername; <br />
protected System.Web.UI.WebControls.TextBox txtPassword; <br />
protected System.Web.UI.WebControls.Label lblCorrectLogin; <br />
protected System.Web.UI.WebControls.LinkButton LinkButton1; <br />
protected System.Web.UI.WebControls.Panel pnlLogIn; <br />
protected System.Web.UI.WebControls.Label lblIsAuthenticated; <br />
<br />
<br />
private void Page_Load(object sender, System.EventArgs e) <br />
{ <br />
if (! Page.IsPostBack) <br />
{ <br />
if (Session["isAuthenticated"] == null) <br />
{ <br />
this.lblIsAuthenticated.Text = "null"; <br />
} <br />
else <br />
{ <br />
this.lblIsAuthenticated.Text = Session["isAuthenticated"].ToString(); <br />
} <br />
} <br />
} <br />
<br />
<br />
private void LinkButton1_Click(object sender, System.EventArgs e) <br />
{ <br />
if (this.txtUsername.Text == "admin" && this.txtPassword.Text == "password") <br />
{ <br />
Session["isAuthenticated"] = true; <br />
<br />
Response.Redirect ("hello.aspx"); <br />
} <br />
else <br />
{ <br />
this.lblCorrectLogin.Text = "Authentification Error!"; <br />
} <br />
}
_______________________
I receive this error:
Line 31: if (Session["isAuthenticated"] == null) <br />
Line 32: { <br />
Line 33: this.lblIsAuthenticated.Text = "null"; <br />
Line 34: } <br />
Line 35: else<br />
<br />
Source File: c:\inetpub\wwwroot\authentication\members.aspx.cs Line: 33
_______________________
Thanks for your help!!
|
|
|
|
|
What is your error message? Does your label initialized in InitializeComponent()?
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
mil_an wrote:
Line 31: if (Session["isAuthenticated"] == null)
Line 32: {
Line 33: this.lblIsAuthenticated.Text = "null";
Line 34: }
Line 35: else
Source File: c:\inetpub\wwwroot\authentication\members.aspx.cs Line: 33
You did't say what the error was. You said WHERE it was, but not WHAT...
RageInTheMachine9532
|
|
|
|
|
Hi,
Sorry, this is the error message:
System.NullReferenceException: Object reference not set to an instance of an object.
Thanks,
|
|
|
|
|
As I said you should initialize your label . It may deleteted in your InitializeComponent() method.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Thanks for your help!
May I ask how I may initialize the label?
Thanks again...
|
|
|
|
|
Something like this:
Label mylable = new Label();
this.Controls.Add(mylabel);
If you use VS.NET when you drag and drop controls in your ASPX file it do all the code for you , but if you don't use it or create your class without it, just create simple web project project , add a label in your webform. Then go to your aspx.cs file and find InitializeComponet() method , all you need is there and you copy/paste same things. The controls and their properties/events are all register their and add to the control.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
If the Label is declared in the .aspx file, you don't instantiate it in your code-behind file. The page instantiates it when compiled. Since the code-behind must declare it as protected, this field gets set by the child class (the .aspx page).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Oh, yah. I mixed up with windows application.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
It just occured to me that your using 'this' in front of everything. You don't need to...
RageInTheMachine9532
|
|
|
|
|
Dave Kreskowiak wrote:
It just occured to me that your using 'this' in front of everything. You don't need to...
It doesn't change anything. It refer to Page class and controls are added to it, you can use if you want.
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Mazdak wrote:
you can use if you want.
That's what I mean...it's just a bunch of extra typing for nothing...
RageInTheMachine9532
|
|
|
|
|
This is a very inflexible solution. Why not just use forms authentication? It's really easy to use. You simply put an authentication[^] section in your application's root Web.config file. You can add the credentials - even using plain-text passwords - right there in the file and forego having to implement a database or other data source for credentials. Then add an authorization[^] section for each location (either in your root's Web.config or in sub-directories' Web.config files) for directories you want to protect.
Then just read about the FormsAuthentication[^] class for a simple example of a page to gather credentials and the code to create the authentication token, which is an encrypted token (read: secure - much more than sessions).
This gives you the flexibility to support different data sources for credentials. And even if one day you change the username and/or password, with your approach you'd have to recompile for something so trivial. Even which putting this in the Web.config file you can change it easily without having to do anything else (the change would case the web application to restart but that's transparent).
If you want to add role-based authorization, see my article, Role-Based Security with Forms Authentication[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm creating a data-driven Windows Form dialog which has two combo boxes both of which are lookups to the same table: one is HomeNationID , the other CurrentNationID looking up the Nation (NationID, Description) table.
I have set both combos to have their DataSource as my Nation table with DisplayMember as Nation.Description and ValueMember as Nation.NationID .
When I Show the form I get a runtime error Error creating window handle. (an OutOfMemoryException ), it's InnerException is Object reference not set to an instance of an object., the stack trace goes back through ComboBox.SetItemsCore , ListControl.DataManager_ItemChanged and Forms.Control.UpdateBindings (with some others in between).
I can't add the Nation table a second time to the DataSet (not allowed two tables with the same name).
This doesn't seem like a particularly odd requirement - two combos with the same lookup table.
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
Only use "Description" and "NationID" as the DataMember value, not "Nation." prepended to them. See the documentation and the example for the ListControl.DataSource property (which ComboBox inherits) foro more information.
Also, if you want to better understand why, read about the CurrencyManager .
You can have two combos with the same lookup table, though. One problem you might have that I've seen a few times is that since binding is a two-way deal, changing the value of one combobox will change the other. If this happens, simply use DataTable.Clone to get another DataTable to bind to.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Actually, the combo boxes work perfectly on their own, there is only a problem if they both link to the same lookup DataTable. The problem is that of sharing the DataTable. I was hoping that there was a more elegant solution than cloning the DataTable but if that's the only way...
Thanks
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
Pete Burgess wrote:
...there is only a problem if they both link to the same lookup DataTable.
That's what I was describing, which is why I said you have to clone the DataTable .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can I get the name of the user who started the app?
Thanks.
Nilson
|
|
|
|
|
Environment.UserName
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Thank you very much.
Nilson
|
|
|
|
|
Hi all.
I am designing a C# project which has so much to do with databases. Up to now , I didn't have much experience about multiuser apps.
Which database (Access , SQLServer, NOT Oracle ....) should I use for a "multiuser & high-frequency accessed & middle mass" data record?
Any proverb or url is welcome. (A comparison schema you know?)
Utku KAYA
|
|
|
|
|
Access is not for multiuser usage, its a desktop database. You should use SQLServer .(Of course I didn't talk about price & licening)
Mazy
"Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland
|
|
|
|
|
Access can be used for workgroups, but it isn't optimized for such and can be much slower since it is file-based.
Microsoft MVP, Visual C#
My Articles
|
|
|
|