|
hey
i m creating a web appln in c#. recently i implemented session var in my website to enhance security.. but the problem is that after publishing this website on IIS(inetpub\wwwroot..), i opened it from my browser.. the sessions are not at all working..
even after entering correct username and pass.. i m redirected to login page again and again..
on the other hand when debugging the application, it works perfectly well.. m using visual web dev exp 2005
please help
Kunal Piyush
|
|
|
|
|
Sounds like either A) A windows Permissions error as debug is run in Admin or B) The code is not synced.
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
well.. as i said before implementing session variables..the thing was perfectly fine..
but still how do i go bout fixing the errors u said...
Kunal Piyush
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Sorry to post this but, here goes.
All of the coding I've ever done, and gotten paid for it, has been VB. I'm working on a project now that I decide to do in C#. It's a breath of fresh air, let me tell ya. It reminds of my days in college doing C++ and makes me realize how brain dead doing VB can make a guy!
Anyway, what's with this escape character stuff in C# strings? I'm having a heck of a time coming up with a regular expression that will match IP addresses with leading zeros, and I think my problem may be the escape character "/". I tried replacing / with // but still no matches. In fact every regex I found on the web for IP addresses failed to match.
Here is the function:
private void RangeCheck()
{
String sLine = "";
String sIPMatcher = "(\\[0-9]{1,3})\\.(\\[0-9]{1,3})\\.(\\[0-9]{1,3})\\.(\\[0-9]{1,3})";
RegexStringValidator test = new RegexStringValidator(sIPMatcher);
StreamReader sr = new StreamReader("c:/UniqueIPaddr_list.csv");
while (!sr.EndOfStream)
{
sLine = sr.ReadLine();
try
{
test.Validate(sLine);
if (IPList.CheckNumber(sLine))
{
lstBox.Items.Add(sLine);
}
}
catch
{
}
}
}
IPList is a class I borrowed from Bo's article here[^].
And here is an example of one of 10,000+ IP address in the .csv file: 00x.0xx.xxx.0x0
where x is any number 1-9 (didn't want to disclose an acutal IP).
No matter what I try, no matches occur. Is it my lack of C# skills, or just use of an incorrect regex?
-- modified at 10:25 Thursday 24th August, 2006
|
|
|
|
|
Hi,
try this.
(\d{1,3}\.){3}\d{1,3}
hope this works.
Nitin...
|
|
|
|
|
This will also match invalid IPs like 999.999.777.444
This one will match only well formed IPs:
^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$
(got that one from Regexlib.com)
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
dotnethead wrote: String sIPMatcher = "(\\[0-9]{1,3})\\.(\\[0-9]{1,3})\\.(\\[0-9]{1,3})\\.(\\[0-9]{1,3})";
You can use
String sIPMatcher = @"(\[0-9]{1,3})\.(\[0-9]{1,3})\.(\[0-9]{1,3})\.(\[0-9]{1,3})";
@ character considers all characters to be text inside " "
Try it !
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Anant Y. Kulkarni wrote: @ character considers all characters to be text inside " "
Golden, just what I was looking for!
Unfortunately Anant, your regex did not match. I think it must be the leading zeros?
The only regex that matched anything was:
String sIPMatcher = @"(\d{1,3}\.){3}\d{1,3}";
Although it will match 999.999.999.999, I know for sure that all of the IP's containing all numbers are good ones. There are however, ones with letters in them, which is why I need this regex.
Thanks for all the help....it was nice to come back to all the responses after a long meeting!
|
|
|
|
|
Hi,
dotnethead wrote: Unfortunately Anant, your regex did not match.
Actually i didnt changed the regex. I only suggested a part of solution for your escape character problem. Sorry, that i was not clear what i have posted.
-- modified at 1:55 Friday 25th August, 2006
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Hi,
this is the modified version of my previous regex which i posted.
Regex rx =new Regex(@"^(\d{1,3}?\.){3}\d{1,3}$");
this will check the proper format for ip.
but this will also match no.s greater than 255.
so what you can do is first apply above regex expression for valid format and if found correct you can split the ip and check for each part no. is not greater than 255.
hope this works.
Nitin...
|
|
|
|
|
Thanks I'll give it a shot.
|
|
|
|
|
hi all...
i am trying to delete all the data in printer spooler
here is my code
ProcessStartInfo pns=new ProcessStartInfo("net","stop spooler");
System.Diagnostics.Process.Start(pns);
string syspath=Environment.GetFolderPath(Environment.SpecialFolder.System);
DirectoryInfo drdd= new System.IO.DirectoryInfo(syspath+"\\spool\\PRINTERS");
foreach(System.IO.FileInfo fin in drdd.GetFiles())
{
fin.Delete();
}
pns=new ProcessStartInfo("net","start spooler");
System.Diagnostics.Process.Start(pns);
everything works fine .. but the problem is if we want to print again , then we have to manually go and refresh that printer folder(where the printers are listed ) how can i automate that ..
thanx
Akhil
|
|
|
|
|
If you open your control panel (under XP) ==>
open "Sounds and Audio Devices" ==>
choose the "Audio" tab ==>
"Sound Recording" group-box ==>
Click "Volume..." button
then a window appears allowing you to choose your recording input path.
How can I program it using C# or any other language (4 eg to control selecting mic or line-in input signal)?
Greatly appreciated, this is really a challenging question..
-- modified at 10:08 Thursday 24th August, 2006
لا إله إلا الله
|
|
|
|
|
Hello
For this you must use DirectX. Here is an articles about capturing audio, and choosing which line to capture from.
DirectX.Capture[^]
For more Try the Media section[^] in CP.
I hope this helps.
Regards
|
|
|
|
|
Many thanks for your help , BUT the directX gives you the opportunity to choose among different audio devices, what I need is to be able -after choosing a certain audio device- to enable/disable the line-in or mic within the choosed audio device.
لا إله إلا الله
|
|
|
|
|
Hello
Enabling or disabling audio lines using C# would be problematic, I think. You may not do it entirely using C#. You'll have to make some Win32 API calls.
An article that would do exactly what you are looking for is Here[^]. Take a look at example 4 specially. Unfortunetaly the article is written in C++
I hope this would help, for more articles about audio and video, you may look Here[^]. Again most of them is written in C++.
Regards
|
|
|
|
|
Thanks my bro Nader, I will delve inshallah now into the Win32 APIs .
Thanks for your help
لا إله إلا الله
|
|
|
|
|
Hi,
I have developed a windows application, which open a TCP connection to some machine on some port. Then i can send any commands to the server. I get responses from the server. For example i am opening connection with Mail server and issue POP commands then i can get the list of mail messages, retrieve mail messages from server. Until now there is no problem. But i want to know how can we open a secured connection to server in the above scenario ?
Any help would be appreciable !
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Hello
If you use .net 2.0 then you might want to check AuthenticatedStream clss in your MSDN.
Regards
|
|
|
|
|
I tried posting this to the ASP.NET forum and got no response, so I'll try here.
I will be developing some .NET C# GUIs that will use one or more web services to get and display information. The web services the GUIs use may need to do some things that require the security environment of a process running from the local hard disk, such as accessing the registry, creating a socket connection to a process on the local or a remote host, etc.
All of this is not an issue if I develop the GUIs as C# applications. However, it occurred to me that there might be some advantage in creating them as user control libraries, where the controls are hosted in IE web pages (with the web page .html files and the DLLs containing the C# user control libraries installed locally on each client, not downloaded over the internet). My concern is that an article I have read (15 Seconds : Hosting .NET Windows Forms Controls in IE) indicates that if the hosted user controls access the web services and the web services try to do something like access the registry, create an event log, make a socket connection, etc., then they may fail due to security restrictions. Given that all the user control libraries are local to the machines running them hosted in IE, is there a simple way to set up security so that these controls (and the services they use) have permissions to do essentially the same things that a GUI program could do? I don't want to make the system vulnerable or upset system administrators, so if it isn't a simple and relatively safe thing to do, I'll just go with the native applications.
|
|
|
|
|
In Win32, we can open a file without specifing the ".exe" file which associate with it by "ShellExecute" function . For example:we can open "*.txt" just specifing the filename not needing the "notepad.exe". But how to implement this
in C#?
|
|
|
|
|
System.Diagnostic.Process.Start( "file" ).
I think it's a wrapper around ShellExecute.
|
|
|
|
|
In My XP service pack2 OS SQL Server 2000 not installed it asks me to install latest service pack What is the latest service pack version where its available
SParthis
|
|
|
|
|
For Windows XP it is SP 2
For SQL Server 2000 it is SP 4
|
|
|
|