|
|
Hi everyone,
i'm just writing on a server-application which contains a few HTTP-Handlers.
Now i have a Windows-Client (in future a few other clients) and want now, that only my clients are able to access those ashx-files.
Is there a simple way to secure this? Can i put something like a "certificate" in my request of the client or something else? Or should i simple encrypt my content with a asymetric key?
What do you think, any ideas?
Thank you!
|
|
|
|
|
Hi
I have created a WCF service and hosted the service as a windows service, i am able to browse from the browser like
http://localhost:8080/webservices/dataservice.svc?
when i browse i am getting the intro screen saying about svcutil.exe and generating proxies.
i have some 2 methods inside the WCF service and is running as a windows service.when i make a call to the service in order to call and execute the function inside it , i am not getting any reply but always it shows the intro screen with metadata.
How to call the method inside windows service(WCF service as windows service)
method call from browser
http://localhost:8080/webservices/dataservice.svc/GetQuote
procedure created to make wcf as winservice
public class ServiceProjectInstaller:ServiceBase
{
public ServiceHost serviceHost = null;
public ServiceProjectInstaller()
{
ServiceName = "WCFService";
}
public static void Main()
{
ServiceBase.Run(new ServiceProjectInstaller());
}
protected override void OnStart(string[] args)
{
TraceWinService("Starting a Service");
Timer timer = new Timer();
timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
timer.Interval = 60000;
timer.Enabled = true;
if (serviceHost != null)
{
serviceHost.Close();
}
serviceHost=new ServiceHost(typeof(myService.dataService.CDataService));
serviceHost.Open();
}
private void OnElapsedTime(object source, EventArgs e)
{
TraceWinService("Another Event at: " + DateTime.Now);
}
protected override void OnStop()
{
if (serviceHost != null)
{
serviceHost.Close();
serviceHost = null;
}
}
private void TraceWinService(string content)
{
FileStream fs = new FileStream(@"d:\ScheduledService.txt", FileMode.Open, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.BaseStream.Seek(0, SeekOrigin.End);
sw.WriteLine(content);
sw.Flush();
sw.Close();
}
private void InitializeComponent()
{
}
}
[RunInstaller(true)]
public class ProjectInstaller : Installer
{
private ServiceProcessInstaller process;
private ServiceInstaller service;
public ProjectInstaller()
{
process = new ServiceProcessInstaller();
process.Account = ServiceAccount.LocalSystem;
service = new ServiceInstaller();
service.ServiceName = "WCFService";
service.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
Installers.Add(process);
Installers.Add(service);
}
}
config file
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ICDataService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8080/WCFService/dataservice.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IClickDataService"
contract="Dvmwebservices.IClickDataService" name="WSHttpBinding_IClickDataService">
<identity>
<servicePrincipalName value="host/ac.sdwe.sw.co.in" />
</identity>
</endpoint>
</client>
<services>
<service name="myService.CService.CDataService" behaviorConfiguration="CDataServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/WCFService/dataservice.svc"/>
</baseAddresses>
</host>
<!-- This endpoint is exposed at the base address provided by the host: http:
<endpoint address="" binding="wsHttpBinding" contract="myService.CService.ICDataService"/>
<!-- the mex endpoint is exposed at http:
To expose the IMetadataExchange contract, you
must enable the serviceMetadata behavior as demonstrated below -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
<behaviors>
<serviceBehaviors>
<behavior name="ClickDataServiceBehavior">
<!-- The serviceMetadata behavior publishes metadata through
the IMetadataExchange contract. When this behavior is
present, you can expose this contract through an endpoint
as shown above. Setting httpGetEnabled to true publishes
the service's WSDL at the <baseaddress>?wsdl
eg. http://localhost/servicemodelsamples/service.svc?wsdl -->
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
After coding the above build and deployed the .exe as service using InstallUtil tool present in vs2010.
i want to know how to call services method from browser.
|
|
|
|
|
Satish_S wrote: call services method from browser
AFAIK you can't
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
how to restrict access to a web application just for mobile terminals,( not having access from a pc)
thinks
|
|
|
|
|
I use the following code snipet to determine if a user is visiting my web page from a Blackberry. (the default mobile device supported by my orgainization)
I believe this would work to detect any mobile deveice.
If (Request.Headers("X-Wap-Profile").ToString().Length > 0) Then
End If
Good luck.
|
|
|
|
|
thinks a lot
but i'm testing this code:
bool IsMobi = false;
if (Request.Headers["X-Wap-Profile"] != null)
{
Response.Redirect("erreur.aspx", true);
}
else {
if (Request.Headers["X-Wap-Profile"].ToString().Length > 0)
{
IsMobi = true;
Response.Redirect("login.aspx", true);
}
else
{
Response.Redirect("erreur.aspx", true);
}
}
}}
but he dosen't work correctly, i detect that "Request.Headers["X-Wap-Profile"] != null"
is null, i testing from a pda hp and o mobile
|
|
|
|
|
Are you sure that Request.Headers["X-Wap-Profile"] returns null , when X-Wap-Profile is not set? Actually, we could expect it to do so, but I'd prefer to include an empty string as a possible return value. Hence, replace
if (Request.Headers["X-Wap-Profile"] != null)
by
if (!string.IsNullOrEmpty(Request.Headers["X-Wap-Profile"]))
|
|
|
|
|
thinks for your reply.
yes i'm sure that returns null , and also your proposition returns null, this is the code used in my form load:
bool IsMobi = false;
if (!string.IsNullOrEmpty(Request.Headers["X-Wap-Profile"]))
{
if (Request.Headers["X-Wap-Profile"].ToString().Length > 0)
{
IsMobi = true;
Response.Redirect("erreur.aspx", true);
}
else
{
Response.Redirect("login.aspx", true);
}
} }
|
|
|
|
|
Hello,
I am having a challenge of using jQueryAutoComplete in my webforms. The problem is when I have selected an item from the suggested items in the textbox, fill other form fields as required, then submits the form, every is fine. But I cannot get the autocomplete working anylonger to process a new entry. What could have been the course of this? See how I did it
<link rel="stylesheet" type="text/css" href="../../Styles/jquery.autocomplete.css" />
<script src="../../Scripts/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>
<script src="../../Scripts/jquery.autocomplete.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#<%=staffNameTextBox.ClientID%>").autocomplete('../../AutoSuggest/SuggestStaffName.ashx');
});
</script>
|
|
|
|
|
Will it work after you refresh the page manually?
|
|
|
|
|
No. It only works once and after postback, it stops working
|
|
|
|
|
The Dom wasn't ready after the postback, thus the conditional statement which roughly states
if DOM is ready then run autocomplete.
$(document).ready(function () {
I suspect that you loaded your JQuery in the wrong section, probably needs to be inside the body or form tags, at the bottom after the textbox objects are created, so the Jquery has something to attach to.
|
|
|
|
|
Okay, I will try your suggestion.
Thanks.
|
|
|
|
|
You point to JQuery or any other JQuery add-on in the head tag
<head>
<script "/Jquery/Jquery.js" />
</head>
<body>
<form>
<script>
</script>
</form>
</body>
|
|
|
|
|
Hi
I am Using .Net framework 4.0 and Ajax 4.1.50401.0
I have ModalPopup inside update panel with properties Drag="true"
, when user click on blank area of panel, I am getting java script runtime error like” Microsoft JScript runtime error: Unknown runtime error”.
Please refer the below statements for more clarification.
_onDragStart: function(ev) {
window._event = ev;
document.selection.empty();
var dt = ev.dataTransfer;
if (!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer;
var dataType = this._activeDragSource.get_dragDataType().toLowerCase();
var data = this._activeDragSource.getDragData(this._activeContext);
if (data) {
if (dataType != "text" && dataType != "url") {
dataType = "text";
if (data.innerHTML != null) {
data = data.innerHTML;
}
}
dt.effectAllowed = "move";
dt.setData(dataType, data.toString());
}
},
|
|
|
|
|
Please send me the markups that represent the ModalPopupExtender , the target control, the popup control and the UpdatePanel .
Help people,so poeple can help you.
|
|
|
|
|
I am using paypal sandbox to doing testing, however after click the continue button that i wish to complete the transaction, but the page is keep loading. So i click to go back on the browser, and then click to go forward again, then it will only display "You've already completed your purchase. Please click Close to continue to the merchant." My problem is i want it auto return me the success page, but not click the back and forward to view the return to merchant. thanks you very much and appreciate your answer.
The page keep loading URL
https:
|
|
|
|
|
What version of the PayPal API are you using?
There is usually a field you have to populate indicating the full URL of the success page on your website, after a successful payment is made.
Best to use the PayPal forum and have a PayPal tech answer your question.
|
|
|
|
|
I am using version 76.0, my problem is the page is keep loading and didn't return to complete transaction page. I have to click go to back and then click to go forward, and it will only return me the completed transaction page.
|
|
|
|
|
I was referring to the version name of the API, for example PayPal Pro NVP.
Since your referring to a transaction page, I will assume your using the basic entry level service.
You need to post some code if you want help, or use the PayPal forum to get help.
You should have some sort of structure in code behind, in which you setup your payment environment. If not, then I assuming you used the PayPal Programming interface in the sandbox, and you were not able to complete the setup, in which you customize your PayPal interface including the full URL of both the successful and failed transaction web page on your website.
|
|
|
|
|
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
/*WARNING: Do not embed plaintext credentials in your application code.Doing so is insecure and against best practices.Your API credentials must be handled securely. Please considerencrypting them for use in any production environment, and ensurethat only authorized individuals may view or modify them.*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "xxxxx.hotmail.com";
profile.APIPassword = "xxxxx";
profile.APISignature = "xxxxx";
profile.Environment = "sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "76.0";
encoder["METHOD"] = "SetExpressCheckout";
// Add request-specific fields to the request.
encoder["RETURNURL"] = "https://..../return1.aspx";
encoder["CANCELURL"] = "......";
encoder["CURRENCYCODE"] = "USD";
encoder["PAYMENTACTION"] = "SALE";
encoder["PAYMENTREQUEST_0_AMT"] = "150.00";
encoder["PAYMENTREQUEST_0_ITEMAMT"] = "100.00";
encoder["PAYMENTREQUEST_0_DESC"] = "Mobile";
encoder["NOSHIPPING"] = "0";
encoder["REQCONFIRMSHIPPING"] = "1";
encoder["PAYMENTREQUEST_0_SHIPTOSTREET"] = "1 Main St";
encoder["PAYMENTREQUEST_0_SHIPTOCITY"] = "San Jose";
encoder["PAYMENTREQUEST_0_SHIPTOSTATE"] = "CA";
encoder["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = "US";
encoder["PAYMENTREQUEST_0_SHIPTOZIP"] = "95131";
encoder["PAYMENTREQUEST_0_SHIPTOPHONENUM"] = "408-967-4444";
double totalprice = 0.00;
for (int i = 0; i < cart; ++i)
{
encoder["Name" + i] = from cart;
encoder["L_PAYMENTREQUEST_0_NAME" + i] = from cart;
encoder["L_PAYMENTREQUEST_0_ITEMCATEGORY" + i] = " Digital";
totalprice += from cart;
encoder["L_PAYMENTREQUEST_0_AMT" + i] = from cart;
encoder["L_PAYMENTREQUEST_0_QTY" + i] = from cart;
}
String strtotalprice = string.Format("{0:N2}", totalprice);
encoder["PAYMENTREQUEST_0_AMT"] = strtotalprice ;
encoder["PAYMENTREQUEST_0_ITEMAMT"] = strtotalprice;
string pStrrequestforNvp = encoder.Encode();
string pStresponsenvp = caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
Token = decoder["TOKEN"];
Response.Redirect("https://www.sandbox.paypal.com/incontext?useraction=continue&token=" + Token );
|
|
|
|
|
awakepoh wrote: encoder["RETURNURL"] = "https://..../return1.aspx";
encoder["CANCELURL"] = "......";
It's good practice to hardcode the entire URL for safe measure, but in your case since your developing, you need to hardcode the http://localhost:4987, the url of your web dev in order for the page to return. Or perhaps try a partial url like
/return1.aspx.
Don't forget to set a cancel url for the cancel action. 4987 is just a port number I made up. Use the port number your web dev is using.
The web dev does not support https protocol, so you will have to use http
|
|
|
|
|
Hi friend,
I am working with Client Server windows(VC++ and MFC) project which is connceted via TCP IP concept. it is working fine with in a organization(LAN).but my requierment, server in one location, client in another location.
How to connect Client and Server.
Can i use virualiztion concept?
I do not know how to start.
Do you have any virualiztion concept reference website link?
Please teach me.
|
|
|
|
|
This was originally posted in C# forum but (on advise) I reposted it here and edited the original to direct readers to this new post. Please do not flag as a repost - it isn't! (Unless of course you submit a suggestion for being able to shift posts around to CP suggestions forum too.)
So every new website launched (revamped or whatever) these days ought to have good Bug Tracking/Reporting systems in place as no website is perfect first time. However, I have not recently come across a system that actually works well and would apply to my websites situation. I am trying to make a cloud app where users access stuff entirely online through my site but obviously as I have written the (primitive) access program to them myself, it is going to have bugs. I therefore need a system to allow bug reporting/viewing/tracking or whatever you want to call it.
So what do people think is the best way of doing it?
Obviously the basic requirements are:
A list of existing bug reports (including which are being worked on)
Some method of submitting a bug report
A way for me (the developer) to respond effectively to bug reports and tell users that I am doing so.
Could anyone offer any insite/comment/help as to how best to do this?
Thanks very much,
Ed
|
|
|
|