Showing posts with label computer. Show all posts
Showing posts with label computer. Show all posts

Saturday, March 24, 2012

My host havent got Ajax

Hi;

I want to use Ajax (codename atlas) , my project is working in my computer but my host isn't work (because my host havent got Ajax Confused )

my hosting administrator doesnt allow for setup ajax

What can I do ?please help

THANKS

Sel?uk Ak

Add the needed assemblies to your Bin folder.

Which file I must add \bin directory for standart using ?

Thanks


For RC 1 add: System.Web.Extensions.dll & System.Web.Extensions.Designer.dll usally located C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025 and if you are using the toolkit you must also add: AjaxControlToolkit.dll and this is located where ever the samplewebsite is that came with the Control Toolkit.

I can't found System.Web.Extensions.dll but in this directory (:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025)

I found microsoft.web.extensions.dll and other so I copy this file to my web aplication from the host but after that I take this mistake :(

What Can I do

Thanks

Configuration Error

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message:Could not load file or assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 37: <compilation debug="true">Line 38: <assemblies>Line 39: <add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>Line 40: <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>Line 41: </compilation>


Source File:C:\Inetpub\vhosts\osozluk.com\httpdocs\osozluk\web.config Line:39

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210


You're not using the latest version. See here: http://ajax.asp.net/files/AspNet_AJAX_CTP_to_RC_Whitepaper.aspx

I uninstall ajax Ctp and setup new versiyon after I want try new ajax so I make new project ,in this projet there are only one button and a label

when I click buton label text is change, this project is working my computer but when I copy my host still this is not working (and also I make bin directory and copy System.Web.Extensions.dll ,System.Web.Extensions.Design.dll )

I take this mistake again and againSuper Angry

------------------------------------------------------------

Configuration Error

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message:Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 37: <compilation debug="true">Line 38: <assemblies>Line 39: <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>Line 40: </assemblies>Line 41: </compilation>


Source File:C:\Inetpub\vhosts\osozluk.com\httpdocs\ajaxyeni\web.config Line:39

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

Namespace undefined in gadget

I've developed a very simple gadget. It works on my computer well. I've installed it on LiveCom and it doesn't work. I am sure I amdoing all good, as Atlas documentation writes but I get an error.

Details: on button click I call a function (as in Atlas examples):

function DoSearch()
{
MyNamespace.MyGadgetBridge.Search(.................);
}

The error is: MyNamespace is undefined.

Also of course I have

<atlas:ScriptManager runat="server" ID="scriptManager">
<services>
<atlas:servicereference path="~/HelloWorldService.asmx" />
</services>
</atlas:ScriptManager>

Defined in Gadget:

<

Scripts><atlas:scriptreferencepath="rssgadget_wt.js"/></Scripts>

and simple bridge:

<?xml version="1.0" encoding="utf-8" ?>
<bridge namespace="MyNamespace" className="MyGadgetBridge" >
<proxy type="WSWrapper, App_Code" />
<method name="Search">
<input>
<parameter name="searchKeywords" />
</input>
</method>
</bridge>

It works on my computer. I get this error only on LiveCom, why? what is wrong?

Please help. Thank you.

hello.

can you give more info on this? i haven't tried using bridges from a gadget, but i have called remote web services without any problems by using the iframeexecutor client class...


There is all info you need I think. I am not doing anything difficult. Just the most simple example gadget with brige and javascript call. You can rework Atlas example gadget from documentation to use javascript call instead of declarative for 10 min to have call like:

function DoSearch()
{
MyNamespace.MyGadgetBridge.Search(.................);
}

The error is: MyNamespace is undefined.

This error I get on LiveCom, but woks on my computer

Maybe to install the gadget on LiveCom Microsoft should "allow" my gadget or bridge work there... I do not understand this.

Also I don't understand the process of installation of gadget on LiveCom. What files are copied? How it works from there?

In the call MyNamespace.MyGadgetBridge.Search(.................);
what bridge is called, my or that was installed on LiveCom?


hello.

well, if it's undefined, then the problem is that you're not putting the correct link on the gadget...


Mr.Luis Abreu,

Can you please give me a *hint* as to how you are executing cross domain requests using IFrameExecutor class?

It would be immensely helpful if there is any documentation.

Thanks

Indo.


hello again.

well, here's a quick example i've build a couple of months ago. it uses the amazon service, which is wrapped on a "local" web service. don't forget to uncomment the iframe handler on the web.config file. here's the code (i've built it in april and haven't run in with the latest ctp):

aspx file:

<%@. Page Language="C#" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager runat="server" ID="manager" EnableScriptComponents="false" />
<atlas:Gadget runat="server"
Description="A gadget that let's you search Amazon.com."
ID="myGadget"
Title="Book Search by author name v2">
<ContentTemplate>
<input type="text" class="text" id="_txtSearch" name="_txtSearch" value="enter the name of the book you're interested in" />
<input type="button" id="_btSearch" value="Search" onclick="handleClick()" /><p></p>
<span id="t"></span>
<div id="_content">
</div>
<div id="_panel">
</div>
</ContentTemplate>
<Services>
<atlas:ServiceReference Path="AmazonHelper.asmx" />
</Services>
<Styles>
<atlas:StyleReference Path="~/cap12/livroatlasgadgetv2.css" />
</Styles>
<Scripts>
<atlas:ScriptReference Path="gadgetaux.js" />
</Scripts>
</atlas:Gadget>
</form>
</body>
</html>

js file

// JScript File
function handleClick()
{
LivroATLAS.AmazonHelper.GetBooks(
document.getElementById("_txtSearch").value,
1,
_onCallback);
}

function _onCallback( res )
{
var htmlContent = "";
var totalPages = res.TotalPages;
var currentPage = res.CurrentPage;

var books = res.BooksInCurrentPage;

for( var i = 0; i < books.length; i++ )
{
htmlContent += "<span><a target='_blank' href='" + books[i].Url + "'>" + books[i].Title + "</a></span><br /><span>" + books[i].Authors.join( "<br />" ) + "</span><p />";
}

if( htmlContent != "" )
{
document.getElementById("_content").innerHTML = htmlContent;
}
else
{
document.getElementById("_content").innerHTML = "No books found for that author.";
}

_fillPanel( currentPage, totalPages );
}

function _fillPanel(currentPage, totalPages)
{
document.getElementById("_panel").innerHTML = "";
for( var i = 0; i < totalPages; i++ )
{
var page = null;
if( currentPage != i + 1 )
{
page = document.createElement( "a" );
page.href = "javascript:;";
page.innerText = i + 1;
page.attachEvent( "onclick", _navigateToPage );
page.title = "Navigate to page " + (i + 1 );
}
else
{
page = document.createElement( "span" );
page.innerText = i + 1;
}
document.getElementById("_panel").appendChild( page );
}
}

function _navigateToPage()
{
LivroATLAS.AmazonHelper.GetBooks(
document.getElementById("_txtSearch").value,
event.srcElement.innerText,
_onCallback);
return false;
}

document.getElementById("_txtSearch").select();
document.getElementById("_txtSearch").focus();

asmx file

<%@. WebService Language="C#" Class="LivroATLAS.AmazonHelper" %>
using System;
using System.Web;
using System.Web.Services;
using Amazon;
using System.Configuration;

namespace LivroATLAS
{
public struct BookInfo
{
string _title;
public string Title
{
get { return _title; }
set { _title = value; }
}

string _asin;
public string Asin
{
get { return _asin; }
set { _asin = value; }
}

string[] _authors;
public string[] Authors
{
get { return _authors; }
set { _authors = value; }
}

string _url;
public string Url
{
get { return _url; }
set { _url = value; }
}

public BookInfo(string title, string asin, string[] authors, string url)
{
_title = title;
_asin = asin;
_authors = authors;
_url = url;
}
}

public struct TotalBookInfo
{
private int _currentPage;
public int CurrentPage
{
get { return _currentPage; }
set { _currentPage = value; }
}

private int _totalPages;
public int TotalPages
{
get { return _totalPages; }
set { _totalPages = value; }
}

private BookInfo[] _booksInCurrentPage;
public BookInfo[] BooksInCurrentPage
{
get { return _booksInCurrentPage; }
set { _booksInCurrentPage = value; }
}

public TotalBookInfo(int currentPage, int totalPages, BookInfo[] books)
{
_currentPage = currentPage;
_totalPages = totalPages;
_booksInCurrentPage = books;
}
}

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class AmazonHelper : System.Web.Services.WebService {

[WebMethod]
[Microsoft.Web.Services.WebOperation(true, Microsoft.Web.Services.ResponseFormatMode.Json, true)]
public TotalBookInfo GetBooks( string author, int currentPage ) {
AWSECommerceService service = new AWSECommerceService();
ItemSearchResponse resp = service.ItemSearch(this.GetItemSearch(author, currentPage) );

if (resp.Items[0].Item == null)
{
return new TotalBookInfo(1, 1, new BookInfo[0]);
}

System.Collections.Generic.List<BookInfo> books = new System.Collections.Generic.List<BookInfo>();
foreach (Amazon.Item item in resp.Items[0].Item)
{
books.Add(new BookInfo(item.ItemAttributes.Title, item.ASIN, item.ItemAttributes.Author, item.DetailPageURL));
}

TotalBookInfo info = new TotalBookInfo(currentPage, Convert.ToInt32( resp.Items[0].TotalPages ), books.ToArray());

return info;
}

private ItemSearch GetItemSearch(string author, int currentPage)
{
ItemSearchRequest request = new ItemSearchRequest();
request.Author = author;
request.Count = "5"; //just to be safe :)
request.ItemPage = currentPage.ToString();
request.SearchIndex = "Books";

ItemSearch search = new ItemSearch();
search.Request = new ItemSearchRequest[] { request };
search.SubscriptionId = ConfigurationManager.AppSettings["AmazonId"];

return search;
}

}

}


Thanks for the reply. In one of your posts above, you said you implemented remote web services call using "iframeexecutor client class" ... Thats what I am really interested in. Basically how to do cross-domain calls from the client side without using Helper-webservice.

Any help would be appreciated.

Thanks again,

~Indo.


hello.

if i recall it correctly, there's not much into it. you just need to enable the iframecall.axd handler on the server side and you'll get the call made automatically (ie, the client side proxy will detect that you're invoking a remote web service and it'll use the handler automatically).


Hello...

I don't know if this will solve your problem, but I was receiving the same JavaScript error when implementing a bridge to call a remote web service.

The solution was as simple as adding this tag inside <microsoft.web> in web.config file:

<

webServicesenableBrowserAccess="true"/>

Hope this helps

Jaime


hello Luis

I see in your example following rows:

<atlas:Gadget runat="server"

I use MS AJAX v 1.0 b2 and I can't find this tag (I try asp:Gadget )

and second question - linkhttp://atlas.asp.net/docs/Walkthroughs/DevScenarios/gadget.aspx is not correct now. I have not found correct link :(

Please, help me. Thanks


hello.

unfortunately, gadget integration has been removed from atlas and i think it won't make it when v1.0 is out.


How I can call of web-service? should I create SOAP message?

Thanks


hello again.

as i told you in my previous mail, you cannot use the gadget control since it has been removed from the ajax extensions platform. i think that now you're supposed to use the API of live.com


It is very a pity :(
Thanks again

hello.

well, you can still use AJAX extensions in your gadget, though you do need to write more code without the gadget control.

Wednesday, March 21, 2012

Need help downloading a file to clients computer

I really hope one of you guys can help me with this becauseI have been trying to fix this for a week and I am no further down the roadthan when I started. The task I amtrying to accomplish is this:

User clicks a button which starts an asynchronous processwhich creates an Excel spreadsheet. Thisprocess takes about 5 or 10 minutes. Screenupdates are sent as process runs. At theconclusion of the process I want to download the excel file to the userscomputer and therein lies the problem.

The way I have it rigged now is that a timer control insidean update panel ticks which allows screen updates to happen. This works fine.

When the async process is done, it enables a timer which isoutside the update panel. The synchronoustimer downloads the file however there is no way to disable the timer. I know this wrong however I have no idea howto fix it. The code below illustratesthe general architecture of what I have now. Any help is much appreciated.

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.Security.Principal;using System.IO;public partialclass Worker : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) {if (IsPostBack) { Label2.Text = (string)Session["jobStatus"]; }else { Session["jobCompleted"] =false; Session["userCanceledJob"] =false; Session["jobStatus"] =null; Session["jobObject"] =null; } }private void Notify(string msg) { Label2.Text = msg +" - Current time is " + DateTime.Now.ToLongTimeString(); Session["jobStatus"] = Label2.Text; }private void ProcessCompleteCallBack(IAsyncResult result) {// This is is called when the asycronous process is completed. workerDelegate worker = (workerDelegate)result.AsyncState; worker.EndInvoke(result); Session["jobCompleted"] =true; }protected void Timer1_Tick(object sender, EventArgs e) {//This timer causes an asycronous postback. Label3.Text ="Timer ticked at " + Environment.NewLine + DateTime.Now.ToLongTimeString();if ((bool)Session["jobCompleted"]) { Timer1.Enabled =false; Sync_Timer.Enabled =true; StartButton.Enabled =true; CancelButton.Enabled =false; Label1.Text ="No processes are running."; Label3.Text =""; } }protected void StartButton_Click(object sender, EventArgs e) { StartButton.Enabled =false; CancelButton.Enabled =true; WindowsIdentity winIdentity = WindowsIdentity.GetCurrent(); WorkingClass me =new WorkingClass(); messangerDelegate notify =new messangerDelegate(Notify); workerDelegate worker =new workerDelegate(me.VeryLongProcess); worker.BeginInvoke(notify, winIdentity,new AsyncCallback(ProcessCompleteCallBack), worker); Timer1.Interval = 2000; Timer1.Enabled =true; Label1.Text ="Process started at " + DateTime.Now.ToLongTimeString(); Session["jobCompleted"] =false; Session["userCanceledJob"] =false; Session["jobStatus"] =""; Session["jobObject"] = me; }protected void CancelButton_Click(object sender, EventArgs e) { Session["userCanceledJob"] =true; WorkingClass me = (WorkingClass)Session["jobObject"]; me.CancelJob =true; }protected void Sync_Timer_Tick(object sender, EventArgs e) {// This timer causes a synchronis postback (?) // The timer never gets disabled Sync_Timer.Enabled =false; DownloadThis("import.txt",true); }private void DownloadThis(string fname,bool forceDownload) {// Download Excel file to clientstring path = MapPath(fname);string name = Path.GetFileName(path);string ext = Path.GetExtension(path);string type ="";// set known types based on file extensionif (ext !=null) {switch (ext.ToLower()) {case".htm":case".html": type ="text/HTML";break;case".txt": type ="text/plain";break;case".doc":case".rtf": type ="Application/msword";break; } }if (forceDownload) { Response.AppendHeader("content-disposition","attachment; filename=" + name); }if (type !="") Response.ContentType = type; Response.WriteFile(path); Response.End(); }}public class WorkingClass{public bool CancelJob;public void VeryLongProcess(messangerDelegate notify, System.Security.Principal.WindowsIdentity identity) {// Create Excel file here WindowsImpersonationContext impContext = identity.Impersonate();int recordCount = 10;string msg ="";this.CancelJob =false;for (int i = 1; i <= recordCount; i++) { msg ="Now processing record " + i.ToString() +" of " + recordCount.ToString(); notify(msg);if (!this.CancelJob) System.Threading.Thread.Sleep(500);else { msg ="Job canceled.";break; } }if (msg !="Job canceled.") msg ="Job completed."; notify(msg); }}public delegate void messangerDelegate(string msg);public delegate void workerDelegate(messangerDelegate notify, System.Security.Principal.WindowsIdentity winIdentity);
 
 <%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="DownLoadWorker.aspx.cs" Inherits="Worker" debug="true"%
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript" language ="javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args)
{
//alert('hello there');
//window.open('http://www.ibm.com',target='new');
}
</script>
<br />
<br />
<asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Size="16pt" Text="DownLoad Worker"
Width="192px"></asp:Label><br />
<br />

<br />

<br />

<br />
<asp:Panel ID="MainPanel1" runat="server" Height="256px" Width="472px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<br />
<asp:Label ID="Label1" runat="server" Height="64px" Text="No processes are running." Width="344px"></asp:Label><br />
<br />
<asp:Label ID="Label2" runat="server" Height="64px" Width="344px"></asp:Label><br />
<br />
<asp:Label ID="Label3" runat="server" Height="64px" Width="344px"></asp:Label><br />
<br />
<br />
<br />
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Enabled="False" Interval="2000">
</asp:Timer><asp:Button ID="StartButton" runat="server" OnClick="StartButton_Click" Text="Run a long Process"/> <br />
<asp:Button ID="CancelButton" runat="server" Text="Cancel Process" Enabled="False" OnClick="CancelButton_Click" /><br />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<br />
<br />
<br />
<br />
<br />
<asp:Timer ID="Sync_Timer" runat="server" OnTick="Sync_Timer_Tick" Interval="5000" Enabled="False">
</asp:Timer>
</div>
</form>
</body>
</html

So is the file downloading? or is it not downloading? What is the actual problem? Above you say that it works, but you can't disable the timer... is that your only issue? (a timer not being disabled... so I'm guessing it promts to download the file over and over again)?

Please explain.

Thanks,


Working...??

Solve the issue ot not yet?