|
Hi,
Is there a way to make cross domain webservice call from client code(javascript or xmlhttp)? Webservice is in intranet and not open to the outside world therefore i can't make a server proxy
Thanks,
Amit
Thanks,
Amit
|
|
|
|
|
The short answer is no. At least not to my knowledge.
amitar27 wrote: (javascript or xmlhttp)
When you make an XMLHTTPRequest call it is from a javascript. XMLHTTPRequest is limited to calls to the same domain for security reasons.
|
|
|
|
|
You could use the old iframe trick. You can load an iframe with anything the client has access to, have the iframe hidden, and access its contents via javascript. What we use to do before XMLHTTPRequest was ubiquitous but more work involved.
|
|
|
|
|
I have a console application with the following code:
Dim cmdScript As String = "c:\ourdlls\winzip\wzzip c:\temp\a.zip c:\temp\test.txt"
Shell(cmdScript, AppWinStyle.Hide)
That works fine.
I also have a web application with the same above code. The problem is that although the wzzip command is invoked, it simply does not zip the file. Seems to be some permission problem. Out of desperation, even after giving the winzip and temp folders full control to everyone, it still doesn't work. I then tried by moving the test.txt file to the web application folder, even giving everyone (including the local ASPNET) full control to it as well, but alas, no go.
It appears that wzzip is using some system routine that it doesn't have authority to, but even if I run Filemon, I can't see any authority problems popping up.
I have rewritten the above code so that it uses a separate process and examined the StandardOutput:
Dim ShellProcess As New System.Diagnostics.Process
ShellProcess.StartInfo.FileName = "c:\ourdlls\winzip\WZZIP.EXE" 'test.bat
ShellProcess.StartInfo.Arguments = "c:\temp\a.zip c:\temp\test.txt"
ShellProcess.StartInfo.CreateNoWindow = True
ShellProcess.StartInfo.UseShellExecute = False
ShellProcess.StartInfo.RedirectStandardOutput = True
ShellProcess.Start()
Dim myStreamReader As StreamReader = ShellProcess.StandardOutput
Dim s As String
Do While myStreamReader.Peek <> -1
s &= myStreamReader.ReadLine
Loop
ShellProcess.Close()
If the above code is run as a console application, wzzip writes a line to standard output indicating that the command was invoked and then another line indicating that it zipped the file. When executed from the web application, the standard output shows that wzzip is being invoked, but it doesn't display the line that it zipped the file, or any error either.
Does anyone know how to get wzzip to work from a web application?
|
|
|
|
|
What does it do ? Doesn't .NET 2.0 have zip support ?
You definately cannot interact with the file system above your web application root in .NET.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian, I don't know if .Net 2.0 has zip support. I haven't seen anything regarding that.
As for interacting with the file system outside of the web application, well, I do it all the time! I have web applications that access shared folders all over the place, including other servers.
|
|
|
|
|
Just use SharpZipLib[^]...
----
Yes, but can you blame them for doing so if that's the only legal way they can hire programmers they want at the rate they can afford?-- Nish on sketchy hiring practices
|
|
|
|
|
SharpZip worked. Thanks Shog.
|
|
|
|
|
Hi all ,
i have a recordset that is fetching data from SQL SERVER.
i want to write this recordset in a excel or CSV file using Standard ASP.
how can i do it using Standrad ASP.
Any help will be greatly appritiated..
Many thanks in advance..
Rajnish
|
|
|
|
|
|
Thank you, PrakashBhaskar. I am looking into that now. I have been working with Winzip tech support trying to get their product to work from a web application in .Net to no avail. I have a problem believing it can't be done. They say that their program is registered on a user-to-user basis. The fact that we have a different user than ASPNET in the machine.config file may be related to that fact, but since they don't work with .net, they are clueless. So, maybe that software you suggest is the best way to go.
|
|
|
|
|
Hi I am building an application.in which I send a mail to a user..when user click on that link he is redirected to a html page..
Now what I want is when that particular html page loads it redirected the user to an another aspx page automatically based on the information present in querystring (link which user press).
Plz answer & help this novice programmer..
hiiiiii
|
|
|
|
|
So what is the exact problem you are facing?
|
|
|
|
|
I want the javascript code or methods which can be used to redirect to another page based on value of querystring..when the page loads.
hiiiiii
|
|
|
|
|
you can use this code
window.showModalDialog("abc.aspx?qs1=" + qs1_value + "&qs2=" + qs2_value);
.... //or
window.open("abc.aspx?qs1=" + qs1_value + "&qs2=" + qs2_value);
....//or
window.location.href = "abc.aspx?qs1=" + qs1_value + "&qs2=" + qs2_value;
|
|
|
|
|
and.. how can I access particular value from my querystring????
link is like "http://www.abc.com?pageno=8&id=2"
& "http://www.abc.com?pageno=7&id=2"
I have to access pageno. from this querystring & have to redirect to two different pages based on page no.s?????
hiiiiii
|
|
|
|
|
suppose your link is
"http://www.abc.com?pageno=8&id=2"& "http://www.abc.com?pageno=7&id=2"
then code behind page you can use ...
string page_no = Request.QueryString["pageno"];
|
|
|
|
|
sorry my mistake...
this is a html page..
hiiiiii
|
|
|
|
|
sorry my mistake...
this is a html page..not an aspx page...
hiiiiii
|
|
|
|
|
then you need to use javascript code for that...
this.page_no = "<%=Request["pageno"]%>";
..
|
|
|
|
|
How exactly will that work for a static HTML page? Why don't you google it
|
|
|
|
|
hi guys
i have created a webservice in C#.net 1.1,
there is a class which contains parameterised constructor,
on the client side i dont see this constructor, just default connstructor is seen,
althoug all properties i can access except parameterized constructor,,
why is that?
thanks in advance
best regards
hello
|
|
|
|
|
There can be many reason, one of them can be you have not updated your web reference after making the change. if you can show me a bit of code I can try thinking more
|
|
|
|
|
thanks
here is my class which,c connstructor i cant access on my client side where i am surfing this web service
public class Search
{
#region variables
private string _section;
private string _gender;
private string _uname;
private string _name;
#endregion
#region constructors
//this constructor is not accessed
public Search(string section,string gender,string name, string uname)
{
this.Section =section;
this.Name =name;
this.Gender = gender;
this.UserName =uname;
}
public Search()
{
//
// TODO: Add constructor logic here
//
}
#endregion
#region properties
public string Name
{
get{
if (this._name == null|| this._name ==string.Empty ){return "%";}
return this._name.ToUpper ();}
set{ if( value == null ||value== string.Empty) {this._name ="%";}
else{this._name =value.ToUpper()+"%";}}
}
public string UserName
{
get
{
if (this._uname == null|| this._uname ==string.Empty ){return "%";}
return this._uname.ToUpper();}
set{if (value == null||value == string.Empty){this._uname ="%";}
else{this._uname =value.ToUpper()+"%";} }
}
public string Gender
{
get
{
if (this._gender == null|| this._gender ==string.Empty ){return "%";}
return this._gender;}
set {if (value == null||value == string.Empty){this._gender="%";}
else{this._gender =value;}}
}
public string Section
{
get
{
if (this._section == null|| this._section ==string.Empty ){return "%";}
return this._section.ToUpper ();}
set {if (value == null||value == string.Empty){this._section = "%";}
else{this._section = value;}}
//set{this._section = value;}
}
#endregion
}
//This is my web service method
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
// WEB SERVICE EXAMPLE
// The HelloWorld() example service returns the string Hello World
// To build, uncomment the following lines then save and build the project
// To test this web service, press F5
///
/// it receives as Search type object and return a
/// data set object containg results, null if no data found
///
/// <param name="search" /> search type object which may contain
/// section, gender,name, user name information
///
/// <returns>
//this is the method being invoked by my client
[WebMethod]
public System.Data.DataSet GetEmployees(Search search)
{
try
{
DataSet ds = new EmployeeHanlder ().GetAllEmployees(search.Section,
search.Gender,search.UserName,search.Name);
if (ds==null||ds.Tables[0].Rows.Count ==0){return null;}
return ds;
}
catch{return null;}
//following is my client side code
private void ServiceInvoker()
{
DataSet ds = new DataSet ();
// here parameterized constructor is not available
Service1 ser = new Service1 ();
//just default is available " Search src = new Search();"
//it shud be parameterized
localhost.Search src = new Search ();
src.Section = "its";
ds = ser.GetEmployees (src);
int ctr =ds.Tables[0].Rows.Count;
}
best regards
hello
|
|
|
|
|
The code above looks fine to me. did you try updating your webservice. If your webservice is in a different solution try following:
1. In your main project right click on the webservice and click on update web reference.
2. In your Internet browser type in the webreference and see what come up.
Cheers.
|
|
|
|