|
Hi
I am looking for some help from anyone who can show how I can assign a web service to named pipes. My application is a web application where the web service will be in a separate project. The design I need to implement is where the request from the client to server is one pipe where it needs to invoke a process and then down another pipe, the response, a server to client where this invokes a separate application. I am only passing XML data between the two.
In code project, I saw the two articles on NamedPipes, but being a little new to this, I could with some expert help on how to do this, and how to call the Web Service App from Asp.Net.
Can someone help me, please!
|
|
|
|
|
So you have a Web Service, a client app, and some other app on the server.
You want the client app to contact the web service, which will then activate the server app, which the client app will be waiting to hear from?
|
|
|
|
|
The client, which is an ASP.Net page or my web application, will be waiting to hear from an application, which will on another device via the web service. So, in other words browser, web application, sends XML via web service to another application else where down one pipe, does work, response from this application goes back down another pipe back to my ASP.Net page.
|
|
|
|
|
I want to display a crystal report using two tables from sql server but when report loads only header fields are visible no data is getting displayed.I have a textbox and a button on the page.After clicking on the button report should be displayed.RollNo is entered in the box and is common to both the tables.Here is the code:-
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Web;
using CrystalDecisions.CrystalReports.Engine;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "data source =SHYLOCK2E935FD7F\\SQLEXPRESS;Initial catalog=StudentDetails ;Integrated Security =true";
}
protected void btnShow_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "datasource=SHYLOCK2E935FD7F\\SQLEXPRESS;Initial catalog=StudentDetails ;Integrated Security =true";
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select c.RollNo,c.StudentName,c.Department,p.feetype,p.amount from studentheader c INNER JOIN studentdetails p on p.Rollno=c.Rollno where c.Rollno=" + TextBox1.Text + "";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(ds);
con.Close();
ReportDocument CrystalReport = new ReportDocument();
string reportPath = Server.MapPath("CrystalReport.rpt");
CrystalReport.Load(reportPath);
CrystalReport.SetDataSource(ds);
CrystalReportViewer1.ReportSource = CrystalReport;
CrystalReportViewer1.DataBind();
}
}
|
|
|
|
|
Use the stringbulder to build the string and put debug point to test wheather ur string is formed is the correct one.
for e.g
Dim sbScript as new System.Text.Stringbuilder
sbScript.append("Select eName,eSalary from Emp ")
sbScript.append("where eid=") //Use the single quote after = sign if eid is string
sbScript.append(TextBox1.Text)
cmd.CommandText = sbScript.ToString()
Hope this trick will be helpful to you...
|
|
|
|
|
I am newer to asp.net as well as to general web maker, how to implement the function for user to download one file?
I know this is quite popular function of web, but I do not know how to do it.
thanks.
|
|
|
|
|
This is one sample Example
Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition","attachment; filename=MyPhoto.jpg");
Response.TransmitFile( Server.MapPath("~/images/MyPhoto.jpg") );
Response.End();
|
|
|
|
|
This is working well for images and word documents but not for any exe file
The file gets download but its not opening
|
|
|
|
|
4anusha4 wrote: This is working well for images and word documents but not for any exe file
Obviously that code will not work for exe, that was only for image. Becuase for for exe you have to chnage the content type.
Response.ContentType = "application/exe";
|
|
|
|
|
if (e.CommandName == "download") {
Response.ContentType = "jpeg/doc/exe/jif";
Response.AppendHeader("Content-Disposition", "attachment; filename='" + sfileName + "'");
Response.TransmitFile(Server.MapPath("~/files/" + sfileName));
Response.End();
lblStatus.Text = "File is Downloaded";
}
i used like this
|
|
|
|
|
Great !
|
|
|
|
|
thanks a lot!
I found that you wrote several very useful articles, it is nice of you!
I just start learning ASP.net, hopefully, I can receive more help from you in the future!
|
|
|
|
|
You are welcome
|
|
|
|
|
I googled and googled and I'm all googled out...I can't find anything useful.
How can I add MIME types to my web setup project (i.e. Silverlight MIME types) so that it doesn't have to be added manually after the install?
|
|
|
|
|
Dear All,
I am using XP SP2 os in my pc.
I installed SQL server 2000.
and Created a Virtual directory for my deployed website.
the website runs on deplyoed mode but when i try to access database of sql server it gives an errr 'Login Failed to ABC/ASPNET user'.
i also installed VS2005 and in debug mode my wite is working fine.
what i do for it???...
In enterprise server it shows two server group Local(Windows) and ABC-SQL EXPRESS 2005. here i can access only local server group.
is it try to connect sql server 2005 Express at the time of deplyoed environment???
|
|
|
|
|
check SQL Server password.. is it correct??
|
|
|
|
|
Hello everyone.
I created a page in which user can upload images and delete as well. But the problem is if user uploads an image(fine)..n hits f5 then same image is again uploaded..which means on refreshing the upload event starts. I tried it by putting condition on upload button event !page.postback..but then user is unable to upload @ all..how i fix tis problem..
*thnx*
|
|
|
|
|
After uploading you clear the value of file upload control.....
In UI part hope so validation should be there in such a way that it should not allow user to upload file before selecting
|
|
|
|
|
Ok bt what about..delete controls and sending a message same problem i face there 2..
|
|
|
|
|
After each event redirect it to the current page itself.
if any message to display, assign the message to a session and display in the page load
give..
Response.Redirect(this.Request.Url.ToString(), false);
|
|
|
|
|
Ohh yeah..ur rite..i gt it..it will work..thnx alot!
|
|
|
|
|
I'm using a stored procedure to populate a crystal report, But I get repeatative(duplicated) information on my report- something like 66 pages instead of atleast 2. I want to produce a transactions statement for a particular user, using the crystal report, with the stored procedure getting data from multiple tables, accepting as a parameter the name of a particular client(user). Am I using the crystal report for good purpose or may be the stored procedure isn't just a way of doing it?
|
|
|
|
|
You should be able to use a stored procedure as the datasource for a Crystal report.
1) Verify that when you execute the sproc outside of crystal it is returning the correct number of rows.
2) Make sure you are not performing some join in crystal which is giving you too many unexpected row.
My vision would be that the sproc would return all of the data necessary to generate the report and you would not have to join to any other table for reference data (like user first name, last name, etc), this would make designing the report very straight forward.
Hope this helps.
|
|
|
|
|
I've got a tet box and a button on my page and am using the following code ro encrypt the URL. The only unusual part is is this line in button click event
Dim strValues As String = TextBox1.Text & TextBox1.Text & TextBox1.Text
This I was forced to do beacuse for some reason it didn't like the four digit id (i.e Invalid length for a Base-64 char array) entered into the textbox so I just repeated it three times an on the other side I just look at the first third of the decrypted querysring.
Public Function Encrypt(ByVal stringToEncrypt As String, _
ByVal SEncryptionKey As String) As String
Dim key() As Byte = {}
Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}
Try
key = System.Text.Encoding.UTF8.GetBytes(Left(SEncryptionKey, 8))
Dim des As New DESCryptoServiceProvider()
Dim inputByteArray() As Byte = Encoding.UTF8.GetBytes( _
stringToEncrypt)
Dim ms As New MemoryStream()
Dim cs As New CryptoStream(ms, des.CreateEncryptor(key, IV), _
CryptoStreamMode.Write)
cs.Write(inputByteArray, 0, inputByteArray.Length)
cs.FlushFinalBlock()
Return Convert.ToBase64String(ms.ToArray())
Catch e As Exception
Return e.Message
End Try
End Function
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strValues As String = TextBox1.Text & TextBox1.Text & TextBox1.Text
Dim strURL As String = "PasswordReset.aspx?Key=" & Encrypt(strValues, "!#$a54?3")
Response.Redirect(strURL)
End Sub
My decyption code is:
Public Function Decrypt(ByVal stringToDecrypt As String, _
ByVal sEncryptionKey As String) As String
Dim key() As Byte = {}
Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}
Dim inputByteArray(stringToDecrypt.Length) As Byte
Try
key = System.Text.Encoding.UTF8.GetBytes(Left(sEncryptionKey, 8))
Dim des As New DESCryptoServiceProvider()
inputByteArray = Convert.FromBase64String(stringToDecrypt)
Dim ms As New MemoryStream()
Dim cs As New CryptoStream(ms, des.CreateDecryptor(key, IV), _
CryptoStreamMode.Write)
cs.Write(inputByteArray, 0, inputByteArray.Length)
cs.FlushFinalBlock()
Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8
Return encoding.GetString(ms.ToArray())
Catch e As Exception
Return e.Message
End Try
End Function
Everthing works great EXCEPT when I try to decrypt the number 305930593059 (this is 3059 repeated three times). When executing the line: inputByteArray = Convert.FromBase64String(stringToDecrypt) I error out with "Invalid length for a Base-64 char array". Any other number that I try, even 5 digit ones, work fine.
Is this wierd or what?
Thanks in advance for any help.
|
|
|
|
|
Please post your code with proper formatting inside pre tag :
like,
CryptoStreamMode.Write)
cs.Write(inputByteArray, 0, inputByteArray.Length)
cs.FlushFinalBlock()
Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8
It will then readable easily.
Thanks !
|
|
|
|