|
thank al lot
|
|
|
|
|
Welcome! Sorry it's bad news...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
No problem, ... we are moving to another solution
|
|
|
|
|
i came across itext dll for visual basic to do a form fill ; can I use it with c# ? are there any compatibility issues?
|
|
|
|
|
Provides it's a .NET assembly, it doesn't matter what language the DLL file was written in: it can be used from any language which supports .NET.
So yes, you can use a VB DLL (or EXE) assembly from a C# program as if it was a C# file.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
A minor correction. You can only guarantee that you can use a DLL from one .NET assembly in another if it is inherently CLSCompliant. That's not to say that you can't use an assembly that is marked as CLSCompliant(false), but there's no guarantee that you can.
This space for rent
|
|
|
|
|
I stand corrected!
Or more literally, I sit corrected because it's easier to type...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
There is no way to know without either trying it, reading the documentation, or contacting whoever made it. We have no idea what dll you are referring to so we really can't say. Just try it and find out. That's the easiest thing to do.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
Please help me... I am stuck up with http post using http request.
I have an asp.net applicaton which is hosted locally in IIS(http:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Test Web Page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
function showImage() {
alert('hi');
}
</script>
</head>
<body>
<form id="imageForm" name="imageForm" method="post" action="Default.aspx" >
<input type="text" name="showImage" value="false" />
<input type="submit" name="refresh" value="submit" onclick="showImage();" />
</form>
</body>
</html>
My Default.aspx.cs ;
protected void Page_Load(Object Source, EventArgs E)
{
}
I have a separate c# application which tries to simulate the button click of "refresh" via http post to Default.aspx, here is the code;
string url = "http://localhost/TestWebPage/Default.aspx";
string postDataStr = "showImage=true";
postDataStr += "&refresh=submit";
byte[] postData = Encoding.ASCII.GetBytes(postDataStr);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postData.Length;
req.Proxy = WebRequest.DefaultWebProxy;
using (var reqStream = req.GetRequestStream())
{
reqStream.Write(postData, 0, postData.Length);
}
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream, Encoding.Default);
string pageContent = reader.ReadToEnd();
string status = ((HttpWebResponse)response).StatusDescription;
reader.Close();
responseStream.Close();
response.Close();
My aspx page is already opened in a chrome browser. When the above code is executed, I want the javascript alert in the showImage() function to be displayed in the Default.aspx page in the same browser window itself.
Unfortunately its not happening now... am I missing anything? or is there any good approach to simulate the button click using separate c#?
Please guide.
|
|
|
|
|
The clicks are on the client-side, not the server-side and should never be injected through server-side. That said, you can simulate the click in JavaScript easily, or if the purpose is to just trigger the function you can call the function on the body's load event as well. That would be much better and semantically correct code in your application.
<body load="onLoadFunc()">
<!--
</body>
Then you can write the function, that gets executed on the load,
function onLoadFunc() {
showImage();
}
This will execute the function, as soon as the body finishes loading, thus on the page load. This will be a better approach, as compared to any of the code injections from server.
load - Event reference | MDN
If you want to get a response from the server, and then execute the code on client-side, then I would recommend that you read a bit about Ajax first. Ajax will let you do that easily, that is also JavaScript based service, so please learn more of JavaScript here to perform tasks on client-side.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Prasadaknair wrote: My aspx page is already opened in a chrome browser. When the above code is executed, I want the javascript alert in the showImage() function to be displayed in the Default.aspx page in the same browser window itself.
You're loading the page in an external process, and expecting the response to affect the page in a totally different process?
That's never going to work, for obvious reasons.
If you want to control an existing browser, you'll need to look at using something like Selenium WebDriver[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am trying to fetch data from an API using C# but every time i get 404 error. What can be the problem, is the API is prevented by my firewall or anti virus problem. The API url is totally correct and I have checked it many times.
|
|
|
|
|
What happens if you try to access the API URL directly from your browser?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
404 Not Found Error means that the resource you were trying to reach could not be found on the server. Check if you pointing it correctly.
modified 20-Sep-20 21:01pm.
|
|
|
|
|
You also get a 404 if the firewall is blocking the request, or the host-file is blocking it. It is a rather generic connection-error.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You should be sure that where you're calling the API can be called/reached. I mean, for ex if your App URL is http://localhost/web/home/index make sure that when you call the API can be reached from that URL.
I've happened that when I create an API of Users is only reached by the URL http://localhost/web/user/index (example) and not from http://localhost/web/home/index
A solution can be create a Route, and specify it in the API's method .
|
|
|
|
|
I have been struggling with what Jeff Atwood calls VS's "bastardized regular expression syntax" [^].
Along the way, I found Peter Macej's very useful VS extension for multiple-line-search-replace [^].
It kind of warps my mind that VS, at this late date, doesn't have a built-in multi-line search and replace, and doesn't support a more "standard" RegEx syntax !
Using 'Find in Files' in VS it's easy to limit the search to specific types of files, like *.cs.
Where I am stumped is how to select files that have specific text (keyword) content, and then apply S&R to only the matching files.
The goal is to apply the search replace only to the content in 'file1.cs
While all this is easy to do in UltraEdit (which offers UNIX and Perl regex flavors in addition to its own syntax), I'd like to know if this is possible in VS.
thanks, Bill
«Beauty is in the eye of the beholder, and it may be necessary from time to time to give a stupid or misinformed beholder a black eye.» Miss Piggy
modified 8-Jun-17 7:30am.
|
|
|
|
|
BillWoodruff wrote: I have been struggling with what Jeff Atwood calls VS's "bastardized regular expression syntax"
That only applies to VS2008 and earlier. Since VS2012, the search & replace uses standard .NET regular expressions[^].
Visual Studio uses .NET Framework regular expressions to find and replace text.
Before Visual Studio 2012, Visual Studio used custom regular expression syntax in the Find and Replace windows.
BillWoodruff wrote: how to select files that have specific text (keyword) content, and then apply S&R to only the matching files.
I don't think there's any way to do that in a single step, unless the content you're searching for is the content you want to replace.
You might need to do a "find in files" to find and open the matching files, and then a S&R targeting the open files.
Or were you wanting to limit the S&R based on the file names? I don't think they support regex; you'd need to use DOS-style wildcards instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, Richard,
My impression is that VS 2017 is using some form of JavaScript related regex syntax, which is still as non-standard as when Atwood made his comments in 2006. Of course, you can say it's .NET standard
It took me two days to figure out one multi-line RegEx solution in VS. The MSDN docs were (as so often) useless.
Thanks to Macej's extension ... which will generate a multi-line RegEx for you based on your selection in a code window ... this can be speeded up nicely.
The tricky part of my goal here is applying the S&R recursively to folders/files that contain the "keyword" ... but, applying only to open files may have to suffice.
It ought to be this simple:
Solution.Files.Search(SearchOption.Recursive)
.Where(file => file.Extension == ".cs")
.Select(file => file.StartsWith(@"//Keyword\r\n"))
.ReplaceInFiles(ReplaceOption.All)(@"stuff", @"newstuff);
Yes, that is wishful thinking
best, Bill
«Beauty is in the eye of the beholder, and it may be necessary from time to time to give a stupid or misinformed beholder a black eye.» Miss Piggy
|
|
|
|
|
BillWoodruff wrote: The tricky part of my goal here is applying the S&R recursively to folders/files that contain the "keyword" ... but, applying only to open files may have to suffice.
In VS, you can select files with a name pattern. In Find/replace dialog, define it in Look at these file types.
Moreover, you can select folders (and save this selection for later use) with [...] button next to Look in.
And you can apply the search to open documents only. Select All Open Documents in Look in.
|
|
|
|
|
Thanks, I am familiar with the uses of 'Find/Replace in Files you mention. But, what I am looking for is a way to apply a RegEx find/replace pattern recursively to files in nested folders with a keyword ... without having to open them all, or re-configure the current open code files in VS.
«Beauty is in the eye of the beholder, and it may be necessary from time to time to give a stupid or misinformed beholder a black eye.» Miss Piggy
|
|
|
|
|
BillWoodruff wrote: Solution.Files.Search(SearchOption.Recursive)
.Where(file => file.Extension == ".cs")
.Select(file => file.StartsWith(@"//Keyword\r\n"))
.ReplaceInFiles(ReplaceOption.All)(@"stuff", @"newstuff);
Yes, that is wishful thinking Simple. Write your own VS Add-In.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi Ryan,
I'm curious ... have you written any VS extensions yourself that operated on open project files ?
A reasonable suggestion, but one I just don't have time to pursue. And, I can achieve what I want with UltraEdit. In my research on multi-line replacement, I came across a reference saying NotePad++ also has multi-line find.replace.
thanks, Bill
«Beauty is in the eye of the beholder, and it may be necessary from time to time to give a stupid or misinformed beholder a black eye.» Miss Piggy
|
|
|
|