When you wants to read/get xml from network or from static ip on web then you would required to validate your credentials for that. below is example from which you can learn that how to access xml from another system with validating credentials.
public XmlDocument getXML()
{
string fileName = "123.22.23.2//folderName//xmlName.xml";
Uri myUrl = new Uri("file://" + fileName);
FileWebRequest request = (FileWebRequest)WebRequest.Create(myUrl);
...
Wednesday, January 19, 2011
Tuesday, January 18, 2011
Convert string to array list or convert string array to array list
Convert string to array listConvert string array to array list
To convert string to array list :
ArrayList mylist= new ArrayList( mystring.Split(','));
To convert string array to array list :
ArrayList mylist= new ArrayList(mystringarray)...
How to get url without paramters/query string
Many of times we just wants exact url of our page without parameters. to get it you can use below code:
Request.Url.GetLeftPart(UriPartial.Path)
Solution By: Rajesh Rol...
Monday, January 17, 2011
Best overloaded function for arrayList.IndexOF
This is the best function which you can use for IndexOf Functionality . it provides lots of extra functionality.
public int ArrayIndexOf(string[] arr, string search, int startIndex, bool caseSensitive, bool exactMatch)
{
// if the search is case-sensitive and it runs against exact matches only,
// use the standard Array.IndexOf function
if (caseSensitive & exactMatch)
{
...
Labels:
C#.NET
The best overloaded method match for 'string.Join(string, string[])' has some invalid arguments
While trying to convert arraylist to string with delimiter separated you would encounter this error .
to get rid from it try this:
string str = string.Join(",",(string[]) srchTags.ToArray (typeof(String)));
Solution By: Rajesh Rol...
Labels:
C#.NET
Friday, January 7, 2011
what is the name of the iis process in windows 7 or I am not able to find IIS process in windows 7
if you are using visual studio in windows 7 and you wants to attach your asp.net code with worker process "w3wp.exe". follow below steps.
press: ctrl + alt + P
you will not able to find this process directly there so to get that process in list you will have to check the check box "Show processes in all sessions".
now if you not started your visual studio with admin rights then it will ask you to save and restart visual studio...
Labels:
Error,
Visual Studio
Thursday, January 6, 2011
HTTP Error 500.23 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
HTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
You gets this error mostly in windows 7 when you wants to run you web site using virtual directory on IIS.
This solution is :Open IIS manager, and go to the Application Pool for your site.
Change the properties of the application pool from "Integrated" to "Classic".
Solution By: Rajesh Ro...
Labels:
ASP.NET,
Error,
Visual Studio
Wednesday, January 5, 2011
How to invoke garbage collector programatically
In applications with significant memory requirements, you can force garbage collection by invoking the GC.Collect method from the program. This is not recommended and should be used only in extreme cases.
Solution By: Rajesh Rol...
How many type of caching available in asp.net
ASP.NET supports three types of caching for Web-based applications:
Page Level Caching (called Output Caching)
Page Fragment Caching (often called Partial-Page Output Caching)
Programmatic or Data Caching
Solution By:Rajesh Rol...
Can we call Finalize()?
ofcourse we can call finalize method, and System.gc() is also made for requesting the garbage collection. although System.gc() do not guarantee the garbage collection.
Solution By: Rajesh Rol...
Is it possible to overload static constructor
No its not.
The name of a static constructor must be the name of the class and even they don't have any return type. The keyword static is used to differentiate the static constructor from the normal constructors. The static constructor can't take any arguments. That means there is only one form of static constructor, without any arguments. In other way it is not possible to overload a static constructor.
Solution By: Rajesh...
Types of Triggers
There are two type of triggers:- Row-level and statement-level triggers. A row-level trigger fires once for each row that is affected by a triggering event. For example, if deletion is defined as a triggering event on a table and a single DELETE command is issued that deletes five rows from the table, then the trigger will fire five times, once for each row.
In contrast, a statement-level trigger fires once per triggering statement...
Tuesday, January 4, 2011
Get File size in javascript
function A()
{
var oas = new ActiveXObject("Scripting.FileSystemObject");
var d = document.a.b.value;
var e = oas.getFile(d);
var f = e.size;
alert(f + " bytes");
}
<form name="a" >
<input type="file" name="b" >
<input type="button" name="c" value="SIZE" onClick="A();" >
</form >
</body >...
Monday, January 3, 2011
Run URL from desktop application
You can run/call URL and get response from desktop application private static string GetPageContent(string FullUri)
{
HttpWebRequest Request = default(HttpWebRequest);
StreamReader ResponseReader = default(StreamReader);
Request = (HttpWebRequest)WebRequest.Create(FullUri);
ResponseReader = new StreamReader(Request.GetResponse().GetResponseStream());
...
Labels:
C#.NET
Subscribe to:
Posts (Atom)