|
Is it possible to use ASP.NET Control in MVC Patterns
|
|
|
|
|
Why not! You can use them... MVC is a pattern..There is a framework too that can be used to build ASP.NET application using it.
For more:http://www.asp.net/mVC/[^]
|
|
|
|
|
Good people,
Hello. Our webservice is not working. We should be receiving information via an HTTP POST. However, nothing is working. Below are the code files. Let me know what you think. Thanks in advance for any help or information you can provide. (By the way, some information (e.g. class names, connection strings, etc...) has been removed or changed in order to hide any sensitive information.
<pre>
Imports System.Web.Mail
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Partial Class hbcertification
Inherits System.Web.UI.Page
Public strBody As String = ""
Public sqlInsertStr As String = ""
Public errStr As String = ""
Public txn_id, first_name, last_name, address_street, address_city, address_state, address_zip, address_country, address_phone, payer_email, Price, key, invoice, payment_date, mc_fee, buyer_ip As String
Dim myConn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionInfo"))
'*******************************************************************************************
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
strBody += "Test email sent.<br><br>Customer name: " & Request("first_name") & " " & Request("last_name")
strBody += "<br>Reg Key: " & Request("key") & "<br><br>Transaction ID: " & Request("txn_id") & "<br>Tran Type: " & Request("txn_type")
updateFile(Server.MapPath("log.txt"), strBody)
txn_id = Request("txn_id")
first_name = Request("first_name")
last_name = Request("last_name")
address_street = Request("address_street")
address_city = Request("address_city")
address_state = Request("address_state")
address_zip = Request("address_zip")
address_country = Request("address_country")
address_phone = Request("address_phone")
payer_email = Request("payer_email")
Price = Request("Price")
key = Request("key")
invoice = Request("invoice")
payment_date = Request("payment_date")
mc_fee = Request("mc_fee")
buyer_ip = Request("buyer_ip")
If Request("first_name") <> "" And Request("last_name") <> "" Then
SendMail("jamesrobertson@hotmail.com", "feedback@morris.com", strBody, "Software Order Notification", "sales@morris.com")
Else
Response.Write("<br>Email not sent. Name missing.")
End If
Dim sItem As String
Response.Write("<br><hr noshade size=""1"" />")
If Request.Form("dosubmit") = "1" Then
Response.Write("FORM VALS:")
For Each sItem In Request.Form
Response.Write("<br>" & sItem & " - [" & Request.Form(sItem) & "]")
Next
sqlInsertStr += "insert into aspnet_MorrisCustomerInfo (TransactionID,FirstName,LastName,AddressStreet,AddressCity,AddressState,AddressZip,AddressCountry,AddressPhone,PayerEmail,Price,AuthenticationCode,InvoiceID,PurchaseDate,PaypalFee,PurchaseIPAddress) values ('" & SQLSafe(txn_id) & "','" & SQLSafe(first_name) & "','" & SQLSafe(last_name) & "','" & SQLSafe(address_street) & "','" & SQLSafe(address_city) & "','" & SQLSafe(address_state) & "','" & SQLSafe(address_zip) & "','" & SQLSafe(address_country) & "','" & SQLSafe(address_phone) & "','" & SQLSafe(payer_email) & "','" & SQLSafe(Price) & "','" & SQLSafe(key) & "','" & SQLSafe(invoice) & "','" & SQLSafe(payment_date) & "','" & SQLSafe(mc_fee) & "','" & SQLSafe(buyer_ip) & "')"
runMyQuery(sqlInsertStr, False)
End If
Response.Write("<br>sqlInsertStr is: " & sqlInsertStr)
Response.Write("<br><hr noshade size=""1"" />")
End Sub
'*******************************************************************************************
Sub SendMail(ByVal strEmailAddress, ByVal strEmailAddress_cc, ByVal Email_Body, ByVal Email_Subject, ByVal Email_From)
If Request.ServerVariables("server_name") <> "localhost" Then
Try
Dim resumeEmail As New MailMessage
resumeEmail.To = strEmailAddress
resumeEmail.Cc = strEmailAddress_cc
resumeEmail.From = Email_From
resumeEmail.Subject = Email_Subject
resumeEmail.Priority = MailPriority.High
'resumeEmail.BodyFormat = MailFormat.Html
resumeEmail.BodyFormat = MailFormat.Html
resumeEmail.Body = Email_Body
'System.Web.Mail.SmtpMail.SmtpServer = "morris.com"
System.Web.Mail.SmtpMail.SmtpServer = "relay-hosting.secureserver.net"
System.Web.Mail.SmtpMail.Send(resumeEmail)
Response.Write("<br>Email sent.")
Catch exc As Exception
Response.Write("<br><b>MAIL ERROR OCCURRED</b><br><br>" & exc.ToString() & "<br>From: " & Email_From)
End Try
Else
Response.Write("<br><br><b>TEST RESPONSE</b><br><br>" & strBody & "")
End If
End Sub
End Function
End Class
<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="hbcertification.aspx.vb" Inherits="hbcertification" %>
<!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>Process Data</title>
</head>
<body>
<form id="form1" runat="server">
<br /><br />
</form>
</body>
</html>
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="ConnectionInfo" value="********************************************************" />
<add key="maintable" value="test123" />
<add key="sitename" value="Hyper - Another Dimension" />
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" />
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
</pre>
-- Modified Thursday, April 1, 2010 7:54 AM
|
|
|
|
|
Can you please post just the webservice implementation instead of all? Right now, i don't see any webservice present... is there any? You need to have WebMethods in order to call webservice methods.
Kindly re-check and update the question with it.
|
|
|
|
|
Thank you so much for replying.
I have cleaned up the code to only include the web service code-behind and related ASP/XML code.
Thanks in advance for any insight you can provide.
|
|
|
|
|
Hello coders,
I have a web service which when called, should take the attachment that it got and use it in the response.
The webservice needs to create a csv file with 2 header values like type,location.
Then beneath that would be different rows which would look like this.
type,location
input,C:\input.csv // (I will be getting this C:\input.csv as an attachment)
output,C:\output.csv
imagepath,C:\
imagename,temp
width,800
height,800
I need to create this csv which i will be using and create an image based on this information.
Later i will need to send out the link of the images and the output file as an attachment.
I have found how to create a csv from the database but how do i hard-code it with the data i want?
So when the webservice is called, it will need to perform this. How can i do this???
Any help is appreciated. Thanks.
|
|
|
|
|
It's just a file, write it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have got the csv thing but my problem is mainly with getting the attachment (in the form of C:\output.csv) and after creating the image , i need to send back the image and csv file as attachments.
This webservice would be called and all these functionalities will take place but this service is running only when i press Invoke, how can i avoid this?
|
|
|
|
|
scorpio22 wrote: This webservice would be called and all these functionalities will take place but this service is running only when i press Invoke, how can i avoid this?
If I understand correctly, you want to run the service always right? If that is the case, you cannot do that using a Webservice. Go for Windows Services.
|
|
|
|
|
and how will get the attachments and send the attachments if it is a windows service?
|
|
|
|
|
but my project is actually a web service and not a windows service.
how can i do the attachments thing in a web service?
|
|
|
|
|
|
I have two <asp:buttonfield> in gridview in which i am using one for datakeynames and another for display name. so when i click on name button i want get the text of that button control in gridview_rowcommand
<asp:GridView ID="gvAlRecord" runat="server" AutoGenerateColumns="False"
DataKeyNames="ARGSequenceNumber" Height="200px"
onrowcommand="gvAlRecord_RowCommand" Width="100%"
onrowdatabound="gvAlRecord_RowDataBound"
onrowcreated="gvAlRecord_RowCreated">
<Columns>
<asp:ButtonField ButtonType="Link" CommandName="Sequence_No"
DataTextField="ARGSequenceNumber" HeaderText="Sequence No"
SortExpression="ARGSequenceNumber" />
<asp:ButtonField ButtonType="Link" CommandName="Provider"
DataTextField="ARGProviderName" HeaderText="Provider"
SortExpression="ARGProviderName" />
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#0099FF" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
|
|
|
|
|
Please format the code or markup you post using the pre tags. (look a the code block item above the textbox where you entered you post)
Are you asking a question? I must have missed it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Do you want to effect the Row when clicking on one of the buttons ?
mydevbank.com
|
|
|
|
|
Hi,
I have created a Authentication Class which implements IHttpModule. When it comes to checking to see if the user is authenticated, this class works fine. However, there are some pages that do not require authentication. These are the files that I have:
SecurePage.cs - Inherits from Page with a 'IsSecure' property
secure.aspx - can only be accessed by authenticated user
public.aspx - can be viewed by anyone
login.aspx - page where users are redirected to if they try to access secure.aspx and they are not logged in
Is it possible to find out what type of page is being accessed via the Custom HttpModule?
Thanks in advance.
|
|
|
|
|
I found that the HttpApplicaion.Context.Handler (type of IHttpHandler) is created before the AcquireRequestState event. The Handler contains all the info that I require. So by subscribing to this event allows you to access the page which is calling the Authentication class.
Hopefully this helps someone in the future.
|
|
|
|
|
hi all.....
i have databound the gridview using configure data source wizard....and its working properly the problem is that if i perform any updation in the data base through any databound control database gets updated but the data being displayed in the control is not updated till i restart the application.....is it possible to refresh the data source control through that wizard.....or the only solution is to write the code in .cs file..???
|
|
|
|
|
Try re-binding the data to the control again. Actually you have to do that if you want to have your control updated.
|
|
|
|
|
but how can we rebind it using configure datasource wizard.....can you give ma an example....i'm unable to rebind it using wizard...???
|
|
|
|
|
hi iam using asp.net with c# with sql server
in my grid there is checkbox in the 1st column, then product,price,quantity,total columns available
when user enters the value in quantity field i should get the value in total field (ie) price* quantity
and finally i should get the grandtotal value in the footer
can you give me a example which helps me
|
|
|
|
|
It depends how you want to do this, on the client-side or server-side.
On client-side you need to add some JavaScript to to handle the onblur event for the quantity textbox that will update the other fields. On the server-side you need to handle the postback and bind the other other columns.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
you can use a javascript function and add onchange event for the textbox.
|
|
|
|
|
I have a ASP.NET WebForm on which I have placed a Infragistics WebTab control
The tabs on the control are generated at as the page is rendered. No problem there.
I have then created a UserControl consisting on a standard WebPanel in which I have placed a standard GridView control.
The idea is to add the UserControl to the Tab pane, when the user selects a tab and a PostBack is actioned, at which point the Gridview is populated with data depending on the tab selected.
What I am trying to do is obtain the Height of the parent container and tried the following:-
Dim myParent As Infragistics.WebUI.UltraWebTab.Tab
myParent = Me.Parent
The problem is Me.Parent returns a System.Web.UI.Control where I need to cast the parent as a Infragistics.WebUI.UltraWebTab.Tab
Any help, greatly appreciated
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Did you try casting the control to tab type? Did you get any errors?
If Third party controls are .NET compatible then you must be able to cast that 'control' to tab control.
Above all, if you contact Infragistics forum directly did you get any problem out there as they must be in better position to help you out as they have provided the dll. Isn't it?
Thanks,
Arindam D Tewary
|
|
|
|
|