|
KSuthar wrote: if the user deletes the xml file, he can crack into the system.
Why? If the application can not validate the password by using your xml file, in other words, the validation fails. In this case, the app should not let the user login. Hence, it should not be the problem at all.
I Love KongFu~
|
|
|
|
|
And if the user deletes the xml file by going to the physical location of the file. what shall I do in such case. as of now my program recreates the xml with default password.
|
|
|
|
|
KSuthar wrote: And if the user deletes the xml file by going to the physical location of the file. what shall I do in such case. as of now my program recreates the xml with default password.
That's entirely up to you and your app specifications how it should respond. Recreating with a default password seems reasonable, IF it doesn't compromise the secruity of your data.
Oh! You can't stop someone from deleting the file...
|
|
|
|
|
KSuthar wrote: what shall I do in such case.
If the user has the administration authority, I do not think we can stop him/her to delete the file. Maybe you can design you app logic again for validating password.
KSuthar wrote: as of now my program recreates the xml with default password.
Is it safe enough for you? If yes, go ahead.
I Love KongFu~
|
|
|
|
|
Hello everyone,
Here is my code at both client side and server side. My code is simple, just upload a file to an ASP.Net web site.
My client code throws exception when it works on Vista (x64, Enterprise, SP1), but works fine on Windows Server 2003.
Any ideas?
10.10.12.162 is my server address.
Client:
static void Main(string[] args)
{
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);
DateTime begin = DateTime.Now;
byte[] responseArray = null;
try
{
responseArray = myWebClient.UploadFile(uriString, fileName);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.ToString());
}
DateTime end = DateTime.Now;
Console.WriteLine("Elapsed time is: {0}", (end - begin).TotalMilliseconds);
}
Server:
public partial class FileUploadHandler : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
foreach (string f in Request.Files.AllKeys)
{
HttpPostedFile file = Request.Files[f];
file.SaveAs("D:\\UploadFile\\UploadedFiles\\" + file.FileName);
}
}
}
Exception from client side:
Unable to connect to the remote server
System.Net.WebException: Unable to connect to the remote server ---> System.Net.
Sockets.SocketException: No connection could be made because the target machine
actively refused it 10.10.12.162:1031
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.WebClient.UploadFile(Uri address, String method, String fileNam
e)
at FileUploadClient.Program.Main(String[] args) in D:\UploadFile\FileUploadClient\Program.cs:line 30
regards,
George
|
|
|
|
|
It could be a firewall blocking the connection. Try disabling the firewall for a moment and see if it connects. If it does work then you will need to configure your firewall to allow the connection.
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Thanks SK,
1.
Do you mean checking firewall at client side or server side?
2.
I have checked my firewall is off at server side, and the server is Windows Server 2003. I have made another test which using browser from another machine to access http://10.10.12.162:1031/<some existing URL>, and IE on another machine can not access the URL. But IE on the same machine (which the server runs) could access the URL.
I have two further questions,
A. If the firewall is off (checked from Control Panel --> Firewalls), any other points to check which may block network connection?
B. I run the web server from Visual Studio directly by pressing F5 on the Windows Server 2003 machine, other than run from IIS web server. I am not sure whether running from Visual Studio will only enable client to access locally?
regards,
George
|
|
|
|
|
iwant to add a looping string into an arraylist ,each loop string value in each index of the arraylist..how?can somebody help me?
|
|
|
|
|
Could you give us a specific example?
I Love KongFu~
|
|
|
|
|
foreach (string st in arrayList)
{
...
}
|
|
|
|
|
Hi, all
A little bird told me there are three type of JIT: Pro-JIT, Ecno-JIT, Normal-JIT. How can we set the JIT type for our application?
Thanks.
Dragonfly
I Love KongFu~
|
|
|
|
|
If you google this and find that it's not a pile of BS, I'd sure love to know about it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I just want to know if the JIT type can be decided by Microsoft or programmer. I am pleased if you can offer an effective link, too.
I Love KongFu~
|
|
|
|
|
High on that oak-tree, the birds are singing about native compilation and stuff. It's even the right answer to one of those "tech interviews" that you can find with Google
The moderator on the Microsoft forum has some other explanation;
Shawn wrote: NGWS - now that's a blast from the past. It stood for Next Generation Web Services (one of the many code names .NET went through before it was released).
You're correct that Pre-JIT is what today is called NGEN. You can use it by running ngen install <path to="" assembly="">
(Source)[^]
What those birds didn't read;
MSDN says Once you create a native image for an assembly, the runtime automatically uses that native image each time it runs the assembly. You do not have to perform any additional procedures to cause the runtime to use a native image. Running Ngen.exe on an assembly allows the assembly to load and execute faster, because it restores code and data structures from the native image cache rather than generating them dynamically.
(Source)[^]
I are troll
|
|
|
|
|
Eddy Vluggen wrote: It's even the right answer to one of those "tech interviews" that you can find with Google
Thanks, Eddy Vluggen.
Actually, I know the differences for these three type of JIT. I just want to know how to choose the JIT type and the related cmd.
I Love KongFu~
|
|
|
|
|
I don't think we get to choose that much, only whether we want to precompile or not. I couldn't find a satisfactory answer either
I are troll
|
|
|
|
|
OK, thanks, Eddy.
I Love KongFu~
|
|
|
|
|
Hi Expert,
I am Using the Calibri Fonts in Crystal Report.Report is cumming correctly in Crystal Viewer But when i export it in PDF. Some Sentence is cumming wrong. How i can fix this problem when i export the Report in PDF.Any kind of suggestion is highly appreciated.
Thanks
|
|
|
|
|
Hi, don't know really where to post this but because I wrote the program in c# to solve this problem, I guess its as good a place as any.
Project Euler is for bored programmers (like myself) that like to solve problems.
Well I am pretty sure I solved problem 9[^] correctly, yet the site tells me i'm crazy.
The answer I got was:
{200, 375, 425} [a^2 + b^2 = c^2]
And the product of abc is 6375000000.
Am I reading the problem wrong?
This checks out on my end, please double check this for me and let me know I'm not crazy.
Matthew Hazlett
Fighting the good fight for web usability.
|
|
|
|
|
Heres the code if you want to see how I did it:
int objectNum = 1000;
for (int counterOne = 1; counterOne < objectNum; counterOne++)
{
for (int counterTwo = 1; counterTwo < objectNum; counterTwo++)
{
double a = Math.Pow(counterOne, 2);
double b = Math.Pow(counterTwo, 2);
double c = Math.Sqrt(a + b);
if (Math.Truncate(c) == c)
if (counterOne + counterTwo + c == (double)objectNum)
Console.WriteLine("{0}, {1}, {2}", counterOne, counterTwo, c);
}
}
Matthew Hazlett
Fighting the good fight for web usability.
|
|
|
|
|
lol, the answer is right, I just multiplied wrong to get the product.. lol
I'm an idiot.
The correct answer is: 31,875,000
Matthew Hazlett
Fighting the good fight for web usability.
|
|
|
|
|
Hi All,
I am currently working on using the ajax autocomplete application that queries from the database for the input entered into the textbox. However nothing shows when i load it up and i am unsure as to whether it is to do with the way i have created the web method or maybe to to do with the static method. Nonetheless it does not work.
Would anyone be able to provide assistance for this? Many Thanks + Kind Regards.
<br />
-Class<br />
<br />
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.HtmlControls;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Xml.Linq;<br />
using System.Web.Services;<br />
using System.Data.SqlClient;<br />
<br />
public class MyClass<br />
{<br />
public MyClass()<br />
{<br />
}<br />
<br />
<br />
<br />
<br />
public static string [] GetCountry(string country)<br />
{<br />
<br />
string query = "SELECT DISTINCT COUNTRY FROM CUSTOMERS WHERE COUNTRY LIKE @Country";<br />
using (SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\NORTHWIND.MDF;Integrated Security=True;User Instance=True"))<br />
{<br />
<br />
SqlDataAdapter adapter = new SqlDataAdapter(query, conn);<br />
adapter.SelectCommand.Parameters.Add("@Country", SqlDbType.VarChar, 15).Value = country + "%";<br />
DataTable dt = new DataTable();<br />
adapter.Fill(dt);<br />
string[] items = new string[dt.Rows.Count];<br />
int i = 0;<br />
foreach (DataRow dr in dt.Rows)<br />
{<br />
items.SetValue(dr["Country"].ToString(), i);<br />
<br />
i++;<br />
}<br />
return items;<br />
<br />
<br />
<br />
<br />
}<br />
}<br />
}<br />
<br />
<br />
-Web Method<br />
<br />
using System;<br />
using System.Collections;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.Services;<br />
using System.Web.Services.Protocols;<br />
using System.Xml.Linq;<br />
<br />
[WebService(Namespace = "http://tempuri.org/")]<br />
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]<br />
[System.Web.Script.Services.ScriptService]<br />
public class WebService : System.Web.Services.WebService {<br />
<br />
public WebService () {<br />
<br />
}<br />
<br />
[System.Web.Services.WebMethod]<br />
[System.Web.Script.Services.ScriptMethod]<br />
<br />
public string [] GetMyCountry(string country)<br />
{<br />
<br />
return MyClass.GetCountry(country).ToArray();<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
- Source Code<br />
<br />
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>]]><br />
<br />
<![CDATA[<br />
<br />
<br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head runat="server"><br />
<title>Untitled Page</title><br />
<style type="text/css"><br />
.style1<br />
{<br />
width: 170px;<br />
}<br />
</style><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<br />
<table style="width: 100%; height: 161px;"><br />
<tr><br />
<td class="style1"><br />
</td><br />
<td><br />
</td><br />
<td><br />
</td><br />
</tr><br />
<tr><br />
<td class="style1"><br />
Choose a Country</td><br />
<td><br />
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox><br />
</td><br />
<td><br />
</td><br />
</tr><br />
<tr><br />
<td class="style1"><br />
<cc1:autocompleteextender id="AutoCompleteExtender1" runat="server" targetcontrolid="Textbox1" servicepath="WebService.asmx" servicemethod="GetMyCountry" minimumprefixlength="1" completionsetcount="12" enablecaching="true" xmlns:cc1="#unknown"></cc1:autocompleteextender></td><br />
<td><br />
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown"><br />
<services><br />
<asp:servicereference path="WebService.asmx" /><br />
</services><br />
</asp:scriptmanager><br />
</td><br />
<td><br />
</td><br />
</tr><br />
</table><br />
<br />
</div><br />
</form><br />
</body><br />
</html><br />
<br />
<br />
|
|
|
|
|
We have an ASP.NET forum.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
assume i have a class named "Student" with the attributes of "Name", "Id" & "Address".
i make a list of "Student" type where i add only "Name" & "Id"
i want to show this data in a data grid view.
if the data grid is custom then how could i manage the column number here?
i want to get the number of attributes which i add in the list & it's may be dynamically changed.
thanks in advance.
raihansazal
|
|
|
|
|
raihansazal wrote: named "Student" with the attributes of "Name", "Id" & "Address".
Maybe you mean property in you case, not attributes.
raihansazal wrote: i make a list of "Student" type where i add only "Name" & "Id"
i want to show this data in a data grid view.
You mean you did not want to display the Address in datagrid view?
I Love KongFu~
|
|
|
|