|
how can i convert aspx pages to HtML pages. please help me out. if there is any tool available for that please let me know.
Amit Grover
Amit Grover
CDAC R&D
Gist Group
pune
|
|
|
|
|
Most browsers let you save the html code of a page.
If you need to do this programatically, use a WebRequest to get the pages, and just save the response string.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I'd like to execute a program from within my class; how can I do this ?!?
Regards,
Stefan
|
|
|
|
|
Take a look at the Process[^] class.
The easiest way to execute a program is using its static Start method:
Process.Start("IExplore.exe"); or
Process.Start("IExplore.exe", "www.northwindtraders.com");
www.troschuetz.de
|
|
|
|
|
Ok, danke!
|
|
|
|
|
http://www.codeproject.com/csharp/start_an_external_app.asp
Easy, isn't it?
Gruß
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Easy, but hard to find... Thx!
|
|
|
|
|
hello .
plze tell me how to get the target (source) of shortcut in c# code.
thanks.
|
|
|
|
|
The easiest way is to create a Runtime-Callable Wrapper (RCW) using tlbimp.exe from the .NET Framework SDK from shell32.dll. This contains the automation objects that you can use with managed code via the RCW.
To do this, run the following
tlbimp /out:Interop.Shell32.dll /namespace:Microsoft.Interop.Shell32.dll shell32.dll You can then write code similar to the following using the Folder , FolderItem and ShellLinkObject classes:
using System;
using System.IO;
using Microsoft.Interop.Shell32;
class ShellLink
{
const int ERROR_SUCCESS = 0;
const int ERROR_FILE_NOT_FOUND = 2;
const int ERROR_PATH_NOT_FOUND = 3;
const int ERROR_INVALID_PARAMETER = 87;
const string OUTPUT_FORMAT = "{0} -> {1}";
static int Main(string[] args)
{
string directory, name = null;
switch (args.Length)
{
case 0:
directory = Environment.CurrentDirectory;
break;
case 1:
directory = args[0];
if ((directory[0] == '/' || directory[0] == '-') &&
(directory[1] == '?' || directory[1] == 'h'))
{
Usage(Console.Out);
return ERROR_SUCCESS;
}
directory = Path.Combine(Environment.CurrentDirectory, directory);
break;
case 2:
directory = args[0];
name = args[1];
break;
default:
Console.Error.WriteLine("Error: invalid number of parameters.");
Usage(Console.Error);
return ERROR_INVALID_PARAMETER;
}
ShellClass shell = new ShellClass();
Folder folder = shell.NameSpace(directory);
if (folder != null)
{
if (name != null)
{
FolderItem item = folder.ParseName(name);
if (item != null)
{
DisplayLink(item);
}
else
{
Console.Error.WriteLine("Error: file not found.");
return ERROR_FILE_NOT_FOUND;
}
}
else
{
foreach (FolderItem item in folder.Items())
{
DisplayLink(item);
}
}
}
else
{
Console.Error.WriteLine("Error: directory not found.");
return ERROR_PATH_NOT_FOUND;
}
return ERROR_SUCCESS;
}
static void DisplayLink(FolderItem item)
{
IShellLinkDual link = null;
if (item != null)
{
if (item.IsLink)
{
link = (IShellLinkDual)item.GetLink;
if (link != null)
{
Console.WriteLine(OUTPUT_FORMAT, item.Name, link.Path);
}
}
}
}
static void Usage(TextWriter writer)
{
if (writer != null)
{
writer.WriteLine("Usage: {0} [directory [name]]",
Path.GetFileName(Environment.GetCommandLineArgs()[0]));
writer.WriteLine();
writer.WriteLine("\tdirectory Path to a directory.");
writer.WriteLine("\t If not specified, the current directory is used.");
writer.WriteLine("\tname The name of a single shell link.");
writer.WriteLine("\t If not specified, all links are displayed.");
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi all,
Here is the scenario i have 3 database table 1.lcsh 2.sub 3. terms
i need to write a select query which will fill datatable let say we get multiple record in that multi record i will take 1 value say lcshid from lcsh with this lcshid and again run another select query for database table 2.sub, we get multi rec and again taking 1 value from say nid from sub with this nid field again running another select query for datbase table 3.terms and finally select the fields which should be display in XSLT... this execrise is for mapping two fields this is my code snippet...
objTempNodes = objXml.SelectNodes("//dc:Subject",objNameSpaceMgr);
sData[5] = "";
foreach (Xml objNode in objTempNodes)
{
foreach(XmlAttribute ElementAttr in objNode.Attributes)
{
if (ElementAttr.Value=="dcterms:LCSH")
{
SubjectLCSH=objNode.InnerText;
if(SubjectLCSH.Trim()!="")
SubjectLCSH = RemoveDups(SubjectLCSH);
objNode.InnerText = SubjectLCSH;
}
if (ElementAttr.Value=="dcterms:DLTaxonomy")
{
try
{
//Select the record in db in LCSH Terms
SqlConnection conn = new SqlConnection();
conn.ConnectionString = new SqlConnection(Global.sConnectionString);
conn.Open();
sqlAdapter = new SqlDataAdapter();
sqlAdapter.SelectCommand = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
//Building the query for Selecting record From the SubjectTermsMapping
da = "Select " + ConfigurationSettings.AppSettings["connstrsubjmapping"] + " where DDC ='" + strDDC + "'";
sqldataset ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
}
catch
{
//SubjectDL = "Final Value";
//End Here
objNode.InnerText = SubjectDL;
}
finally
{
sData[5] = "NLBTerms:~LCSH:" + SubjectLCSH + "~DLTaxonomy:" + SubjectDL + "~SASH:";
}
}
}
suggest me how to do the above mention query i need to check the condition of each field ex:lcshid is avaiable r not if no then it should not move to next query...
Regards
ybasha
|
|
|
|
|
First, you do not need to open a connection when using a DataAdapter derivative. The DataAdapter will open and close the connection as necessary.
Second, to avoid connecting back to the server multiple times - and for large data sets this could require a tremendous amount of time on the user's part and lots of bandwidth on your server - have SQL Server do the work using joins like the following example:
select o.* from Orders o left outer join Customers c on o.CustomerID = c.CustomerID Third, you can implement relationships in your DataSet between DataTable s using a DataRelation . In Visual Studio, if you add a new DataSet class to your project you can import these tables from Server Explorer (or author them yourself, but this takes more time and is prone to error) then draw relationships between fields from different tables. This creates the DataRelation for you. Be sure to look at the code to see how it's done, or read the documentation[^] for the class for an example.
Your SqlCommand for your SqlDataAdapter then should have two SQL statements in one command to fill each table (separated by a semicolon) or swap the SqlDataAdapter.SelectCommand with second command and fill the same table with a different table mapping (the previous data would be saved).
Then you'd have a DataSet with everything you need already with only a one (or two, if you do the latter suggestion of a second command and calling DataAdapter.Fill again) connection to the server. This would be a much more efficient use of network bandwidth and the database server that is designed to handle this sort of query.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi there,
I am using C#. I have to create a random unique identifier that will be used as a primary key in my table. I created a string array dynamically that contains all upper case letters, and numbers 0-9 like this:
private ArrayList m_arrCharPool;
private string m_sExcludeChars = "IO01";
In the constructor I initialise my array:
m_arrCharPool = new ArrayList();
// Clear the array
m_arrCharPool.Clear();
// If required, include uppercase letters A thru Z
if(m_bIncludeLetters)
{
for(int i = 65; i < 91; ++i)
{
m_arrCharPool.Add(Convert.ToChar(i).ToString());
}
}
// If required, include numbers 0 thru 9
if(m_bIncludeNumbers)
{
for(int i = 48; i < 58; ++i)
{
m_arrCharPool.Add(Convert.ToChar(i).ToString());
}
}
So basically my array looks something like this:
"A", "B", "C".... "7", "8", "9"
No you will see I create a string variable called m_sExcludeChars. This variable represents all the characters that are not allowed in the array. So now I need to loop through the m_arrCharPool array, and search for each character in m_sExcludeChars, and delete that array element totally from the array.
My loop is something like this, but I know it is wrong. Can someone please help me with my loop so that it performs correctly. If I can do this whole process differently, please let me know:
// Remove the following characters from the array: I, O, 0, 1
for(int i = 0; i < m_arrCharPool.Count; ++i)
{
foreach(char j in m_sExcludeChars)
{
if(m_arrCharPool.IndexOf(j))
{
m_arrCharPool.RemoveAt(i);
}
}
}
Regards,
Brendan
|
|
|
|
|
The problem with your loop is that you are looping through an array and deleting elements from it within the loop. Copying the contents into another array, deleting elements from it and then reassigning this copied array to the original array should do the trick.
ArrayList copyOfCharPool = new ArrayList(m_arrCharPool);
for(int i = 0; i < m_arrCharPool.Count; ++i)
{
foreach(char j in m_sExcludeChars)
{
if(copyOfCharPool.IndexOf(j))
{
copyOfCharPool.RemoveAt(i);
}
}
}
m_arrCharPool = copyOfCharPool;
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks for the reply.
Correct me if I am wrong, but it looks almost exactly like my code. What you are doing is to assign my original to a copy array, looping through the copy array, removing the elements, and then assigning the copy array back to the original array. I don't think my way works, but isn't it longer doing it your way? Why can't you do it my way?
|
|
|
|
|
ma se wrote:
looping through the copy array,
No I didn't, I looped through the original array and that's the key to this problem. Like I said in my earlier post, looping through a collection and deleting elements from it at the same time will not work correctly.
int []a = new int[]{1,2,3,4,5,6,7,8,9, 10};
ArrayList arrayList = new ArrayList(a);
for (int i = 0; i<arrayList.Count; ++i)
arrayList.RemoveAt(i);
How many times do you think the loop will run? It won't run 10 times, most probably will run 5 or 6. In fact, if you use the foreach statement instead of for to loop, you'll get an exception stating that you can't modify the collection when enumerating over it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks
I will try it out at home and get back to you tomorrow.
You sure the loop in the first reply will work 100%? So I will be left with (36-4) elements?
B
|
|
|
|
|
Why not just use a string that contains all available characters?
const string chars = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
---
b { font-weight: normal; }
|
|
|
|
|
Because there are 2 properties that can be set to either false, or true. So the user can choose if there is just letters, numbers or both. Then it generates the string/array like you mentioned, that is, if he chose numbers and letter.
Must I then still do it this way as you mentioned??
|
|
|
|
|
Then put the letters in one string and numbers in another, and concatenate these according to what the user has chosen.
string chars = string.Empty;<br />
if (m_bIncludeLetters) chars += letters;<br />
if (m_bIncludeNumbers) chars += numbers;
---
b { font-weight: normal; }
|
|
|
|
|
Ok it sounds good enough, but I will still need to loop through it to search for characters not allowed and to remove them. Once I have removed these characters, then from what is left will I create a unique id of about 9 characaters in length.
private string m_sExcludeChars = "IO01";
If the string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
How do I loop through it and remove the characaters that I have defined in m_sExcludeChars? So the final string should look like this after the 4 characters have been removed:
"ABCDEFGHJKLMNPQRSTUVWXYZ23456789"
O yes, if I declare a char array like:
private char[] chars;
How do I append characters to it? I want a similar result to:
private char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray();
I hope this makes sense.
Regards,
Brendan
|
|
|
|
|
Can't you just remove the unwanted characters from the original string constants?
Otherwise they can be removed with some Replace calls, or more efficiently with a regular expression:
chars = RegEx.Replace(chars, "[IO01]", "");
Do you really need a char array? You can get char values from a string in the same way as from a char array:
char myChar = chars[index];
ma se wrote:
How do I append characters to it? I want a similar result to:
private char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray();
What's wrong with that code?
---
b { font-weight: normal; }
|
|
|
|
|
After an installation for a single user all went well, but it I try the same installation for all users the shortcut on users desktop points not to my application (.exe) but starts the .msi again.
If I start my app (.exe) in the users application folder directly all works fine.
Do I have to install additional folders for a All Users desktop and all users program folder ?
Thanks
Ariadne
-- modified at 10:16 Thursday 6th October, 2005
|
|
|
|
|
I rewrote the whole setup-project: Now it works... It seems an internal error.
Then there is probably a minor bug: If I install a project as all users in the Software-install folder the icon is a yellow folder icon. If I install a project as single user the in the setup project selected icon appears.
Ariadne
|
|
|
|
|
Im working with Sockets in C#, and i have everything working with events and some threads, i am accepting multiple connections i just would like to know how can i detect if a client or a server has closed it's socket. Is there an event or is there a thrown exception is there something i can do to detect this when it happens?
Any help is appreciated.
|
|
|
|
|
hi..
i hav created setup of my desktop application using dot net setup project....i want when installation completes it automatically pop up a readme file ..how can ido this..
thanks
|
|
|
|