|
Hello Everyone,
I used this command aspnet_regsql.exe to create DB for Login Purpose now I want to use Login Control.
Could you please provide me a link to how I can use this with Login Control?
Thanks
|
|
|
|
|
|
Here is a code I use to update records, but it does not work - tough I do not get any error message.Any idea..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace Haas_Login_New
{
public partial class Test : System.Web.UI.Page
{
public int sessionHUID = 5326;
public int roleid = 4;
public SqlConnection dbCon = new SqlConnection("Data Source=.........");
protected void Page_Load(object sender, EventArgs e)
{
SqlDataAdapter ad;
DataSet ds = new DataSet();
string query = "";
query = "select school, address, city, state, district from test1 where school = 'Hello'";
ad = new SqlDataAdapter(query, dbCon);
ad.Fill(ds);
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
txtSchoolName.Text = Convert.ToString(ds.Tables[0].Rows[0]["school"]);
txtAddress.Text = Convert.ToString(ds.Tables[0].Rows[0]["address"]);
txtCity.Text = Convert.ToString(ds.Tables[0].Rows[0]["city"]);
txtDistrict.Text = Convert.ToString(ds.Tables[0].Rows[0]["district"]);
txtState.Text = Convert.ToString(ds.Tables[0].Rows[0]["State"]);
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlDataAdapter ad;
DataSet ds = new DataSet();
string query = "";
query = "select school from test1 where school = '" + Convert.ToString(txtSchoolName.Text) + "'";
ad = new SqlDataAdapter(query, dbCon);
ad.Fill(ds);
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
ad = new SqlDataAdapter();
query = "UPDATE test SET citystatezip = '" + Convert.ToString(txtCity.Text) + ","
+ Convert.ToString(txtState.Text) + "' WHERE school = '" + Convert.ToString(txtSchoolName.Text) + "'";
SqlCommand sql = new SqlCommand(query, dbCon);
ad.UpdateCommand = sql;
}
else
{
ad = new SqlDataAdapter();
query = "Insert INTO test1 (school, district, city, state, address) VALUES ('"
+ Convert.ToString(txtSchoolName.Text) + "','"
+ Convert.ToString(txtDistrict.Text) + "','"
+ Convert.ToString(txtCity.Text) + "','"
+ Convert.ToString(txtState.Text) + "','"
+ Convert.ToString(txtAddress.Text) + "')";
SqlCommand sql = new SqlCommand(query, dbCon);
ad.InsertCommand = sql;
}
}
}
}
|
|
|
|
|
When you click Submit button, the page load event is executed and then btnSubmit_Click will be executed. In the page load event, the textboxes are always updated from the datatable. Therefore the values that you entered in this textboxed will always be cleared during postback.
Put your code in the page load event in a if(!IsPostback) block.
|
|
|
|
|
Thank you.
That will help.
|
|
|
|
|
Hello,
I'm having problems with a website I created. The page tries to read a dbf from a folder in a computer on the network and reads the values to a dataset. I get the error Datatable could not be filled.
The thing is when I put the website on an IIS 6 test server it works fine.
I'm not sure what the problem is, I'm fairly new using IIS 7 and don't understand it very well.
Thank You
|
|
|
|
|
Generally the asp.net application will run under Network Service account in IIS 6.0. Therefore pls check whether the Network Service account has read access to the network folder where your dbf file is stored.
|
|
|
|
|
Ramesh Swaminathan wrote: Generally the asp.net application will run under Network Service account in IIS 6.0.
That is bogus. Where did you get that information from? asp.net never runs under Network Service account. It runs under ASPNET build in account. ^
|
|
|
|
|
Hi Yusuf,
Please read what i had mentioned in my reply. I said asp.net application will run under Network Service account in IIS6.0. IIS 6.0 is used in Windows 2003 and IIS 5.x is used in Windows XP. Usually the asp.net runs under aspnet account in Windows XP.
The question is related to some issue in the server not in the PC. Therefore please read again the MS Technet link carefully.
|
|
|
|
|
How do you get the System.Web.HttpContext.Current.Request.ServerVariables("HTTP_REFERER") in a web service. I need to know where the request is coming from and using the above does not work.
Thanks
|
|
|
|
|
john_paul wrote: How do you get the System.Web.HttpContext.Current.Request.ServerVariables("HTTP_REFERER")
Isn't HTTP_REFERER a HTTP Header and not a Variable?
System.Web.HttpContext.Current.Request.Headers
|
|
|
|
|
Don't bother with server variables or headers. Just use the Request.UrlReferrer[^] property directly.
|
|
|
|
|
I have a datalist having a dropdownlist control on each row. On selecting a particular item of this dropdown, I need to display a page in that particular row of the datalist. There are five different pages and the selection of the page to be displayed depends on the item selected in the drop down list.
Actually, the controls on the pages is waht i need. So instead of the pages if you have any other option do let me know.
Note : The number of rows in the datalist keeps on varying.
|
|
|
|
|
Hi guys,
I am new to ASP.net and I am trying to achieve the following:
I have created a login page where I want only 1 user logged in at any period. Is there a way to get the current # of user logged in, in ASP.Net?
Basically, when second user tries to login, I want to check if there is another user logged in. I tried using session but that doesn't work because each user is on a different computer browsing the site.
Please help!!!!
Sameer
|
|
|
|
|
Saamir wrote: I have created a login page where I want only 1 user logged in at any period
what do you meant only 1 use logged in at any time? I hope you not restricting Only ONE user to connect to your application at a time. If that is what you want, you are in the wrong place. Web app are meant to be used by multiple users at a time.
If you want to limit to a single login to each user, then you need to track who is logged in. When a user logs in then flag that in your users table. Then when the user logs out, remove the flag. Then you need to handle end of session event and remove the flag for that user. When you notice a user tries to log in multiple times, then you can redirect them to different page (may be user already logged in message)
|
|
|
|
|
Hi Yusuf,
Yes I want to only allow one user at a time on the webpage considering the sensitive information processing the page does. Are you saying I should use Session_Start and Session_end? If so, pardon my ignorance but how do I implement these functions?
Sameer
|
|
|
|
|
Saamir wrote: Session_end
Remove the logged on status of the user
|
|
|
|
|
Yusuf,
I know that is what I need to do but my question is how do I go about doing that. If I am updating the database then how do I know that the user has not just closed the webpage instead of loging out.
Do you know what I mean?
Sameer
|
|
|
|
|
I don't know your level of asp.net competency, but your question is a bit silly
- Session_End signals the session is expiring, has nothing to do with user logging out or browser closing
- Browser Closing - There is no way you can detect this from the server. You can write some js to detect browser closing ( mind you there is no browser support for this, all is behind the door hack)
- user logout - the user clicked on logout, so you know that, don't you, don't you....
|
|
|
|
|
Yusuf,
dude, it is just a question, no need for expertise talk or sarcastic talk. Hats off to your smartness and thank you for your help.
Sameer
|
|
|
|
|
no pun intended
|
|
|
|
|
Hi,
I have created a string using StringBuilder class. This string is an xml.
Now my question is that how do i pass this string to xmlTextWriter or XmlDocument class to get the correct format of the string ?
I don't want to start creating the xml using XmlDocument class or XmlTextWriter as it's really cumbersome to nest the xml in it. It's all done using StringBuilder and now i just have to correct the format of the string..
Any idea ??
Thank You
Andyy
|
|
|
|
|
XmlDocument has a method LoadXml that takes a string.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
ok for instance,
testStr is StringBuilder type with having complete xml stored in it.
Now can you please show me the syntax, how can i pass this testStr to XmlDocument to get the correct xml format output.
Thank You
Andy
|
|
|
|
|
What are you trying to do exactly? I thought perhaps you were trying to validate the xml, in which case you could by trying to load it.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|