|
thanks for your answer. thanks for your below code
AuthWebService.WebService webService = new AuthWebService.WebService();
AuthWebService.AuthHeader authentication = new AuthWebService.AuthHeader();
authentication.Username = "test";
authentication.Password = "test";
webService.AuthHeaderValue = authentication;
DataSet dsData = webService.SensitiveData();
i am working with VS2013. i construct my code the same way but in my case i can not pass credentials this way
webService.AuthHeaderValue = authentication;
rather i have to pass auth like this way when calling service function from client side
ServiceReference1.AuthenticateHeader oAuth = new ServiceReference1.AuthenticateHeader();
oAuth.UserName = "Test";
oAuth.Password = "Test";
ServiceReference1.Test1SoapClient oClient =new ServiceReference1.Test1SoapClient();
try
{
var o= oClient.Add(oAuth, 2, 3);
}
catch(SoapException SoapEx)
{
}
catch (Exception Ex)
{
}
tbhattacharjee
|
|
|
|
|
That looks like your spin on the code from the sample app.
You can name the Web Reference whatever you like. And you can rename the Web Reference as Well.
You can also use Fiddler to hook your program in debug and see if the data is attached in the SOAP header. Then you can isolate where your issue really lies.
You capture the request and response, and inspect the data in the right side window.
Fiddler free web debugging proxy[^]
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.
|
|
|
|
|
i have a asmx web service and i attached the Soap Extension just to intercept data and encrypt/decrypt it but the problem is Soap Extension ProcessMessage function not calling
here is my full code with web.config and i am running the code from VS2013.
please see my code and tell me where i made the mistake for which ProcessMessage function not calling
namespace EncryptASMX
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Test1 : System.Web.Services.WebService
{
public AuthenticateHeader Credentials;
[AuthExtension]
[SoapHeader("Credentials", Required = true)]
[WebMethod]
public string Add(int x, int y)
{
return (x + y).ToString();
}
}
public class AuthenticateHeader : SoapHeader
{
public string UserName;
public string Password;
}
[AttributeUsage(AttributeTargets.Method)]
public class AuthExtensionAttribute : SoapExtensionAttribute
{
int _priority = 1;
public override int Priority
{
get { return _priority; }
set { _priority = value; }
}
public override Type ExtensionType
{
get { return typeof(AuthExtension); }
}
}
public class AuthExtension : SoapExtension
{
public override void ProcessMessage(SoapMessage message)
{
if (message.Stage == SoapMessageStage.AfterDeserialize)
{
foreach (SoapHeader header in message.Headers)
{
if (header is AuthenticateHeader)
{
AuthenticateHeader credentials = (AuthenticateHeader)header;
if (credentials.UserName.ToLower() ==
"jeff" &&
credentials.Password.ToLower() ==
"imbatman")
return;
break;
}
}
throw new SoapException("Unauthorized",
SoapException.ClientFaultCode);
}
}
public override Object GetInitializer(Type type)
{
return GetType();
}
public override Object GetInitializer(LogicalMethodInfo info,
SoapExtensionAttribute attribute)
{
return null;
}
public override void Initialize(Object initializer)
{
}
}
}
web.config entry
="1.0"
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<webServices>
<soapExtensionTypes>
<add type="EncryptASMX.AuthExtension,EncryptASMX" priority="1" />
</soapExtensionTypes>
</webServices>
</system.web>
</configuration>
i consult two links but still not configure how to run process message. here are the links
http://www.c-sharpcorner.com/article/using-soap-header-and-soap-extensions-in-a-web-service/
http://www.codeguru.com/csharp/csharp/cs_webservices/security/article.php/c5479/Build-Secure-Web-Services-With-SOAP-Headers-and-Extensions.htm
tbhattacharjee
|
|
|
|
|
this problem has been solved. process message fire when we call web service from client side. thanks
tbhattacharjee
|
|
|
|
|
i need to create a wesite for alumni association of my collage,please help
i wish to do it in asp .net
|
|
|
|
|
|
Sanju govind wrote: please help What do you need? Why come and post what that you need help but then not tell anyone what you need help with? That's strange.
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.
|
|
|
|
|
before we proceed, There are lot of WH here
- what is the requirement
- what is the background
- what about data analysis
- what is table design
- what could be the volumes
- Do you need to implement access permissions
???
Find More .Net development tips at : .NET Tips
The only reason people get lost in thought is because it's unfamiliar territory.
|
|
|
|
|
I am inserting into the database and want to pass the id to the next page via response.redirect but am not sure how to do that.
Here is the code I have:
string custsrc = custsrccode.Text;
string name = custname.Text;
string city = custcity.Text;
string state = custstate.Text;
string postcode = custpostalcode.Text;
string actcode = activitycode.SelectedItem.Text;
string id = labelID.Text;
string activityid = labelactivityid.Text;
OracleConnection conn = new OracleConnection();
conn.ConnectionString = strConnection;
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO BUYING_ACTIVITY (CUSTOMER_SOURCE_CODE, CUSTOMER_NAME, CUSTOMER_CITY, CUSTOMER_STATE, CUSTOMER_POSTAL_CODE, BUYING_ACTIVITY_CODE, ID) " +
"VALUES (:custsrc, :name, :city, :state, :postcode, :actcode, :id)";
cmd.Parameters.Add(new OracleParameter("custsrc", custsrc));
cmd.Parameters.Add(new OracleParameter("name", name));
cmd.Parameters.Add(new OracleParameter("city", city));
cmd.Parameters.Add(new OracleParameter("state", state));
cmd.Parameters.Add(new OracleParameter("postcode", postcode));
cmd.Parameters.Add(new OracleParameter("actcode", actcode));
cmd.Parameters.Add(new OracleParameter("id", id));
cmd.ExecuteNonQuery();
conn.Close();
Response.Redirect("contractinfo.aspx?Id=" + labelRID.Text);
I get nothing on the labelID.Text when I step thru my code and then when it goes to the next page I obviously get nothing as well contractinfo.aspx?Id="" where the "" should be the id value. How do I fix this with the code I have.
|
|
|
|
|
You read the id from labelID
string id = labelID.Text;
But the ID you are passing on the query string is labelRID
Response.Redirect("contractinfo.aspx?Id=" + labelRID.Text);
If it's the same id use the same label, or just re-use the id variable
Response.Redirect("contractinfo.aspx?Id=" + id);
|
|
|
|
|
I have these fields set to the asp controls below:
string contnumber = contractnumber.Text;
string solnumber = solicitationnumber.Text;
string ordnumber = ordernumber.Text;
string contstartdate = contractstartdate.Value;
string contenddate = contractenddate.Value;
string solstartdate = solicitationstartdate.Value;
string solenddate = solicitationenddate.Value;
string soltype = solicitationtype.Text;
string pasnum = pasnumber.Text;
string commnts = comments.Text;
string contkind = contractkind.SelectedItem.Text;
string conttype = contracttype.SelectedItem.Text;
string ponum = ponumber.Text;
string instrtype = instrumenttype.SelectedItem.Text;
string totcontractamount = totalcontractamount.Text;
string estimloddate = estloddate.Value;
string contfirstname = contractfirstname.Text;
string contmiddleinit = contractmiddleinit.Text;
string contlastname = contractlastname.Text;
string lodsigned = datelodsigned.Value;
string contractid = contractinfoid.Text;
when I open the form to update some of these fields the fields don't update when I step thru the code and obviously don't update using this update statement to the database:
OracleConnection conn = new OracleConnection();
conn.ConnectionString = strConnection;
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "UPDATE CONTRACT_INFO SET CONTRACT_SELECTION = :contractselection, CONTRACT_NUMBER = :contnumber, SOLICITATION_NUMBER = :solnumber, ORDER_SELECTION = :orderselection, ORDER_NUMBER = :ordnumber, CONTRACT_START_PERIOD = to_date(:contstartdate, 'MM/DD/YYYY'), CONTRACT_END_PERIOD = to_date(:contenddate, 'MM/DD/YYYY'), SOLICITATION_START_DATE = to_date(:solstartdate, 'MM/DD/YYYY'), SOLICITATION_END_DATE = to_date(:solenddate, 'MM/DD/YYYY'), SOLICITATION_TYPE = :soltype, SURVEY_REQUESTED = :preaward, PAS_NUMBER = :pasnum, COMMENTS = :commnts, CONTRACT_KIND = :contkind, CONTRACT_TYPE = :conttype, PO_ASSOCIATED = :poselection, PO_NUMBER = :ponum, INSTRUMENT_TYPE = :instrtype, TOTAL_CONTRACT_AMOUNT = :totcontractamount, EST_LOD_COMPLETION_DATE = to_date(:estimloddate, 'MM/DD/YYYY'), FIRST_NAME = :contfirstname, MIDDLE_INIT = :contmiddleinit, LAST_NAME = :contractlastname, DATE_LOD_SIGNED = to_date(:lodsigned, 'MM/DD/YYYY') CONTRACT_INFO_ID = :contractid";
cmd.Parameters.Add(new OracleParameter("contractid", contractid));
cmd.Parameters.Add(new OracleParameter("contractselection", contselection));
cmd.Parameters.Add(new OracleParameter("contnumber", contnumber));
cmd.Parameters.Add(new OracleParameter("solnumber", solnumber));
cmd.Parameters.Add(new OracleParameter("orderselection", ordselection));
cmd.Parameters.Add(new OracleParameter("ordnumber", ordnumber));
cmd.Parameters.Add(new OracleParameter("contstartdate", contstartdate));
cmd.Parameters.Add(new OracleParameter("contenddate", contenddate));
cmd.Parameters.Add(new OracleParameter("solstartdate", solstartdate));
cmd.Parameters.Add(new OracleParameter("solenddate", solenddate));
cmd.Parameters.Add(new OracleParameter("soltype", soltype));
cmd.Parameters.Add(new OracleParameter("preaward", preawardselection));
cmd.Parameters.Add(new OracleParameter("pasnum", pasnum));
cmd.Parameters.Add(new OracleParameter("commnts", commnts));
cmd.Parameters.Add(new OracleParameter("contkind", contkind));
cmd.Parameters.Add(new OracleParameter("conttype", conttype));
cmd.Parameters.Add(new OracleParameter("poselection", purselection));
cmd.Parameters.Add(new OracleParameter("ponum", ponum));
cmd.Parameters.Add(new OracleParameter("instrtype", instrtype));
cmd.Parameters.Add(new OracleParameter("totcontractamount", totcontractamount));
cmd.Parameters.Add(new OracleParameter("estimloddate", estimloddate));
cmd.Parameters.Add(new OracleParameter("contfirstname", contfirstname));
cmd.Parameters.Add(new OracleParameter("contmiddleinit", contmiddleinit));
cmd.Parameters.Add(new OracleParameter("contlastname", contlastname));
cmd.Parameters.Add(new OracleParameter("lodsigned", lodsigned));
cmd.ExecuteNonQuery();
conn.Close();
This is used on a button click event. What am I doing wrong. Is there something I need to do when in addition to setting these fields so that they update when I change them on the form and in the database.
|
|
|
|
|
Did you mean to say "fields", or did you mean "local variables"?
Fields (C# Programming Guide)[^]
Variables and Constants[^]
If you're using fields, you're doing it wrong.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I mean I'm setting the variables : string contnumber equal to the asp form control text box: contractnumber.Text. And then I set those variables equal to the database fields in the update statement to update the database. When I make changes to fields on this form (textboxes, dropdowns,etc.) and click Submit button the fields don't get updated to the database. That's the problem that I need help with.
|
|
|
|
|
Debug the code and watch what is happening. You'll solve it in no time.
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.
|
|
|
|
|
I have a dropdown(code is name of the dropdown) that when coming from another page it prefills with a value, the required validator fires off. I have a select statement that fills in all textboxes and dropdowns on this page. When I open this page by itself the validation functions as normal meaning when I select a value from the dropdown no validation and when it is blank it validates. Here is the code for the select statement and reading in the data on page load:
OracleConnection conn = new OracleConnection();
OracleCommand cmd = new OracleCommand();
conn.ConnectionString = strConnection;
conn.Open();
cmd.Connection = conn;
cmd.CommandText = "Select RID, CODE, CUSTOMER_NAME from ACTIVITY WHERE ID = :IDValue";
cmd.Parameters.Add(new OracleParameter("IDValue", Request.QueryString["ID"]));
OracleDataAdapter da = new OracleDataAdapter(cmd);
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
name.Text = dr["customer_name"].ToString();
code.SelectedItem.Text = dr["code"].ToString();
dr.Close();
conn.Close();
I know this has Oracle code in it but it is more of a C#/ASP.net question.
|
|
|
|
|
Bootzilla33 wrote: code.SelectedItem.Text = dr["code"].ToString();
Why are you changing the text of the selected item, rather than selecting the item?
Try:
code.SelectedValue = dr["code"].ToString();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm not changing the text?? I'm calling that value for that dropdown from the database by using the Select statement.
|
|
|
|
|
Bootzilla33 wrote:
code.SelectedItem.Text = dr["code"].ToString();
That changes the text of the selected item. If you want to select a different item, use the SelectedValue property.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Would that fix my original issue of the validator message popping up even though there is something in the field when coming from a prior page? If that fixes it or you think it fixes it then I will try it.
|
|
|
|
|
Yes, I'm pretty sure that will fix it. Your current code is changing the text of the selected item, which probably doesn't have a value.
NB: You could have tried it for yourself and found the answer immediately, rather than waiting over the weekend for my "permission" to try it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Getting error on bolded line, activitycode.Item(I),Value... if you can't see it.
private void cvactivitycode_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = false;
for (short I = 1; (I
<= (activitycode.Items.Count - 1)); I++)
{
if (activitycode.Items(I).Value)
{
args.IsValid = true;
break;
}
}
}
What am I missing or need to fix.
|
|
|
|
|
Might not be the answer but you initialise I to 1 in the for loop, should it not be 0?
|
|
|
|
|
The error says you cannot use Items like a method. You used () instead of []. So, change Items(I) to Items[I]. You are not calling the method Items() you are accessing an item in the collection.
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.
|
|
|
|
|
Seems like you are aware of VB.NET.
if (activitycode.Items(I).Value)
That is VB.NET way of accessing array elements, in C# that is used to invoke functions. What you need is like this,
if (activitycode.Items[I].Value)
This would work — provided no other errors are raised; is Value of bool type?. For more on this, you can just search for, "array indexing in c# vs vb.net", and also "how to call functions in c#" they will give you a good overview of these features.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I am new to javascript but definitely not new to asp.net development. I was wondering why javascript is gaining popularity among asp.net developers
and what functionalities or features within an asp.net web application it is most often used for ;And also I was wondering is there a particular javascript book that would help me to learn the capabilities of javascript when used with asp.net. Thanks
|
|
|
|
|