|
Thank you very much for good answer .
iam new to .net thatswhy i want to confirm from those who has idea of that. else thanks for answering .
Again thanks
best regards
Rameez
|
|
|
|
|
If you're new to .NET, why are you writing a password system for someone ? Oh, because you're cheap.
I don't mind that outsourcing happens, but I am offended at how many completely unqualified people are taking part in it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
You can use Guid to generate random password. Find it on msdn...
|
|
|
|
|
I don't know what is Best, but i can suggest you one which may help you
Random objRan = new Random();
int ran1 = objRan.Next(10000000,99999999);
int ran2 = objRan.Next(1000, 9999);
string strRandom = ran1.ToString() + ran2.ToString() + DateTime.Now.Millisecond.ToString();
you can try this or can even generate your own algo for same.
I think it will assist you to generate a Random number everytime
|
|
|
|
|
Thanks for reply
what about Guid (Global Unique ID) class may i use this for genrating random Password.?
OR
i will use Random object for creating random password ?
which one approach is best ?
Best Regards
Rmaeez
|
|
|
|
|
|
Hello
I have been trying to debug a problem with a web app that I am responsible for and have traced it down to a very specific problem. To demonstrate that problem, I have written a little web app, and I'm sure someone here can direct me quickly to the source of the problem.
Try
Me.Label1.Text = ""
Me.Label1.Text = Date.Parse(Me.TextBox1.Text).ToShortDateString
Catch ex As Exception
Me.Label1.Text = ex.Message
End Try
When I run this on serverA it with the input of '7/30/2007' it fails with the exception message being: 'String was not recognized as a valid DateTime'
When I run it on any other server, it works fine.
On serverA, if I input '30/1/2007' it works. If I input that value on any of my other servers it fails with 'String was not recognized as a valid DateTime'
The question is, what server configuration value do I need to change on the server to make that server behave the same as the other servers.
These are all windows server 2003 servers, and I checked the regional settings in Control panel and the failing and passing servers have the same regional settings values (english US) and the same long/short date format in the regional settings. Apparently that does not affect this date.parse behavior.
This kind of problem scares me because it introduces a significant likelihood of wierd flaky problems and behavior. If the date value had been '2/5/2007' it would've worked on both servers and it would have been hard to identify why all the data was messed up.
Any help or guidance would be appreciated.
|
|
|
|
|
This is asked so often. The regional settings are obviously different, no matter what you think, and either way, apart from the terrible naming conventions, no production code should ever use Date.Parse, that's what Date.TryParse is for. I wouldn't actually sack someone for writing this code, but there's quite a number of htings I'd be having a talk to them about.
You will always face this issue - if you're moving dates from strings, you risk getting the wrong dates unless you can be sure of the setup on the server. Either way, it's best avoided. I'm all for using a 17 Feb 1969 format, as it's unambiguous.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I love pompous know-it-all responses that don't answer the question.
Christian, it seemed pretty obvious that the code was written for purposes of demonstrating the problem and was not supposed to be "production code". Feel free to spend as much time as you'd like refactoring it and bringing it up to your standard.
I did some additional reading, and found this very helpful knowledge base article about stabilizing culture specific behavior in asp.net apps - if anyone else has a similar question in the future..
http://support.microsoft.com/kb/326943[^]
|
|
|
|
|
Hello,
I am reading a CSV file into the memory using a streamreader object. I was wondering if there's a way to skip every other line.
ABCD........ (read it)
EFGH........ (skip it)
Here's how I'm reading the csv file:
Command.Parameters.Add("@FirstName", SqlDbType.Nvarchar);
Command.Parameters.Add("@LocationCode", SqlDbType.Float);\
Command.Parameters.Add("@Zip", SqlDbType.Float);
for (int i = 0; i < 11; i ++)
{
while ((line = sr.ReadLine()) != null)
{
string[] col = line.Split(',');
cmd.Parameters["@FirstName"].Value = col[i];
cmd.Parameters["@LocationCode"].Value = col[i + 1];
.
.
cmd.Parameters["@Zip"].Value = col[i + 10];
cmd.ExecuteNonQuery();
}
} Thanks
Tina
|
|
|
|
|
You want to execute code in this way:
ABCD........ (read it)
EFGH........ (skip it)
IJKL.........(read it)
MNOP.........(skip it)
and so on?
Do you want to execute code inside while loop in every odd case?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hello there, thanks for the speedy response. Sorry couldn’t write back sooner. Yes I do want to skip every other line….chances are its going to be the odd line every single time, however as I said the data is pretty out of whack, so if they decided to add another line before we receive it…it may switch to even.
Is there a way to do code it in a way to skip either one (even or odd line) depending on my data coming in?
Thanks
Tina
|
|
|
|
|
You have to read the line then skip it in code. You can't tell the streamreader to read every other line directly.
If you know it's every other line, always, then do this:
while ((line = sr.ReadLine()) != null)
{
{
if ((line = sr.ReadLine()) != null)
{
xx
If you want the odd numbered line, do the second read at the end of the block.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello there, thanks for the speedy response. Sorry couldn’t write back sooner. Yes I do want to skip every other line….chances are its going to be the odd line every single time, however as I said the data is pretty out of whack, so if they decided to add another line before we receive it…it may switch to even.
Christian Graus wrote: If you want the odd numbered line, do the second read at the end of the block.
Could you please elaborate on the above statement Unfornunately I don't see how would it skip the line?
Is there a way to code it in a way that it'll skip either one (even or odd line) depending on my data coming in?
Thanks
Tina
|
|
|
|
|
You'd have to read the line and then parse it if you wanted to decide as you go which line to skip. It skips a line because it reads two lines, the code to read a line is repeated, and so it reads two before doing anything with the data.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Sorry once again about the delayed response to your earlier post...i was out of town Thanks once again Christian!
I guess that make sense...is this scenario capable of handling even and odd both (lines to skip)? I'm going to try it out later tonigt but just checking with you? Thanks
Tina
|
|
|
|
|
Yes, either read two lines, then parse, or read a line, parse, then read another before the loop goes back.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello, Christian...sorry I've been a little sick lately. ANyways, i tried but it won't work quite the way you said.
I swithced to using a TextFieldParser class in Microsoft.VisualBasic.FileIO namespace.
Here's what I'm doing:
using (TextFieldParser textParser = new TextFieldParser(sFileName))
{
textParser.TextFieldType = FieldType.Delimited;
textParser.HasFieldsEnclosedInQuotes = false;
textParser.SetDelimiters(",");
while (!textParser.EndOfData)
{
Measurements myMeasure = new Measurements();
String[] currentRow = textParser.ReadFields();
myMeasure._EmplNum= double.Parse(currentRow[0]);
myMeasure.DATE = DateTime.Parse(currentRow[1]);
myMeasure.Day = Convert.ToString(currentRow[2]);
myMeasure.Process(myMeasure);
}
}
where Process is a custom method that is used to instantiate dataContext and then invoke the stored procedure (by calling its method that is generated by LINQ to SQL)
public void Process(Measurements measObj)
{
MyDataContext dataContext = new MyDataContext();
dataContext.InsertDaily(measObj.EmplNum, measObj.Date, measObj.Day);
}
In the first code block where I'm setting up the while loop, i need to set it up in such a way that it'll skip some lines (say first 100) from the CSV file (in other words a few hundred lines of data upfron is useless and needs to be discarded but it'll be part of the CSV coming in) and then when it finally find the place where the actual data begins (lets say a keyWord such as 'Target' or something along those lines, then perhaps I need to do a string.Substring and find it...then starts reading it? I'm not quite sure how to accomplish that keeping the above code in mind.
Any advice.
Thanks a lot
Tina
|
|
|
|
|
Hey I was wondering how to use windows authentication.
In IIS what do I set? Everything I have tried setting still requires a username and password when going into the page. Now in the page I have coded it to pull active directory information.
By using User.Identity.Name I was able to get the information from AD like Division, Full name, email address. But the user still needs to login to the web page. Well our users on the local network are already logged into the network.
So how do I use User.Identity.Name without them logging into the webpage? I have set Digest Windows Authentication and when tyring to view the web page it pops up asking for a username and password.
With SharePoint it gets this information without the user logging in. If the user is logged into the network it automatically gets the information through a web page.
|
|
|
|
|
Hi,
I have a Custom control derived from webcontrol. This control has an UpdatePanel as its member variable. In the constructor of the UpdatePanel I am creating the childcontrols of the UpdatePanel
this.updatePanel.ContentTemplateContainer.Controls.Add(this);
What I want to achieve here is that when I do something like control.Invalidate(), the UpdatePanel should force the control it is tied to, to rerender i.e. call the Render method of the custom control.
for some reason this is not working. Can someone please give me some pointers on what I am doing wrong.
Thanks,
Alomgir Miah
Live Life King Size
|
|
|
|
|
An update panel means you're in the right forum. Does the Invalidate method force a postback on the AJAX control ? Or are you saying you're trying to work out what method to call to force an update panel to make an AJAX call ? Just look in the javascriot, work out what the framework calls, and call it. If you wrote AJAX code yourself, you'd know what method to call.
Funny enough, someone asked the same question and got an answer, just a few posts down.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for your reply.
The website I am working in refreshes every second to keep the data up to date. Clicking the control does a AJAX postback and that part is working fine. The problem is that I want to change the control settings in the server due to some server events. Now to force the control rendering independently of all the other controls Invalidate essentially call Update() on the UpdatePanel associated with the control. For some reason the Render method of the control does not get called when the Update is called on the UpdatePanel.
googling this suggests that I need to implement ITemplate, add the control to it and replace the ContentTemplate with it. But it seems this technique is not working.
I hope I am clear enough in what I am looking for.
Thanks,
Live Life King Size
|
|
|
|
|
you want the server to force a control to update ? That can't happen. AJAX doesn't mean the server can talk to the client.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yes it can happen. If the trigger of the UpdatePanel is set to conditional then calling Update() on the UpdatePanel will do an update. Like I was mentioning that I am doing a postback every 1 second and checking for changes. This ensures the Server forcing a client update. Only if somethings happens in the server, a certain UpdatePanel gets updated.
|
|
|
|
|
Yes, you can force it to call every second, but your server can only respond to those calls, it can't make a call to a webpage. Every AJAX call can change the controls on the page, in fact, you can use js to do that any time you like.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|